Skip to content

Commit c197dc4

Browse files
committed
clarify write_bytes a bit
1 parent adcc0d2 commit c197dc4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/intrinsics.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,10 @@ extern "rust-intrinsic" {
11621162
/// // Even leaking `v` "uses" it, and hence is undefined behavior.
11631163
/// // mem::forget(v); // ERROR
11641164
///
1165+
/// // In fact, `v` is invalid according to basic type layout invariants, so *any*
1166+
/// // operation touching it is undefined behavior.
1167+
/// // let v2 = v; // ERROR
1168+
///
11651169
/// unsafe {
11661170
/// // Let us instead put in a valid value
11671171
/// ptr::write(&mut v as *mut Box<i32>, Box::new(42i32));

0 commit comments

Comments
 (0)