Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify how write_bytes can lead to UB due to invalid values #99084

Merged
merged 4 commits into from
Jul 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
typo
Co-authored-by: Ben Kimock <kimockb@gmail.com>
RalfJung and saethlin authored Jul 11, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit eed5df52f63dbf19030fb99045334252fcd5b366
2 changes: 1 addition & 1 deletion library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -2555,7 +2555,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
///
/// Additionally, note that changing `*dst` in this way can easily lead to undefined behavior (UB)
/// later if the written bytes are not a valid representation of some `T`. For instance, the
/// follwing is an **incorrect** use of this function:
/// following is an **incorrect** use of this function:
///
/// ```rust,no_run
/// unsafe {