Skip to content

Commit

Permalink
clarify write_bytes a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Sep 21, 2018
1 parent adcc0d2 commit c197dc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,10 @@ extern "rust-intrinsic" {
/// // Even leaking `v` "uses" it, and hence is undefined behavior.
/// // mem::forget(v); // ERROR
///
/// // In fact, `v` is invalid according to basic type layout invariants, so *any*
/// // operation touching it is undefined behavior.
/// // let v2 = v; // ERROR
///
/// unsafe {
/// // Let us instead put in a valid value
/// ptr::write(&mut v as *mut Box<i32>, Box::new(42i32));
Expand Down

0 comments on commit c197dc4

Please sign in to comment.