Skip to content

Commit ee259e4

Browse files
Change write_bytes test causing UB to no_run
This also fixes improper text wrapping.
1 parent 8b8091d commit ee259e4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/libcore/intrinsics.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,11 @@ extern "rust-intrinsic" {
992992
///
993993
/// * The two regions of memory must *not* overlap.
994994
///
995-
/// Additionally, if `T` is not [`Copy`](../marker/trait.Copy), only the region at `src` *or* the
996-
/// region at `dst` can be used or dropped after calling
997-
/// `copy_nonoverlapping`. `copy_nonoverlapping` creates bitwise copies of
998-
/// `T`, regardless of whether `T: Copy`, which can result in undefined
999-
/// behavior if both copies are used.
995+
/// Additionally, if `T` is not [`Copy`](../marker/trait.Copy), only the
996+
/// region at `src` *or* the region at `dst` can be used or dropped after
997+
/// calling `copy_nonoverlapping`. `copy_nonoverlapping` creates bitwise
998+
/// copies of `T`, regardless of whether `T: Copy`, which can result in
999+
/// undefined behavior if both copies are used.
10001000
///
10011001
/// [Undefined Behavior]: ../../reference/behavior-considered-undefined.html
10021002
///
@@ -1149,7 +1149,7 @@ extern "rust-intrinsic" {
11491149
///
11501150
/// Creating an invalid value:
11511151
///
1152-
/// ```ignore
1152+
/// ```no_run
11531153
/// use std::{mem, ptr};
11541154
///
11551155
/// let mut v = Box::new(0i32);
@@ -1161,6 +1161,7 @@ extern "rust-intrinsic" {
11611161
/// }
11621162
///
11631163
/// // At this point, using or dropping `v` results in undefined behavior.
1164+
/// // v = Box::new(0i32); // ERROR
11641165
/// ```
11651166
#[stable(feature = "rust1", since = "1.0.0")]
11661167
pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);

0 commit comments

Comments
 (0)