We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a626400 commit 4d0b0e9Copy full SHA for 4d0b0e9
src/libcore/ptr.rs
@@ -459,6 +459,9 @@ impl<T: ?Sized> *mut T {
459
/// ```
460
/// let mut s = [1, 2, 3];
461
/// let ptr: *mut u32 = s.as_mut_ptr();
462
+ /// let first_value = unsafe { ptr.as_mut().unwrap() };
463
+ /// *first_value = 4;
464
+ /// println!("{:?}", s); // It'll print: "[4, 2, 3]".
465
466
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
467
#[inline]
0 commit comments