Skip to content

Commit

Permalink
Rollup merge of rust-lang#33056 - GuillaumeGomez:as_mut_ptr_example, …
Browse files Browse the repository at this point in the history
…r=steveklabnik

Improve as_mut ptr method example

r? @steveklabnik
  • Loading branch information
Manishearth committed Apr 27, 2016
2 parents 0fdce5c + 4d0b0e9 commit d9c9c32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ impl<T: ?Sized> *mut T {
/// ```
/// let mut s = [1, 2, 3];
/// let ptr: *mut u32 = s.as_mut_ptr();
/// let first_value = unsafe { ptr.as_mut().unwrap() };
/// *first_value = 4;
/// println!("{:?}", s); // It'll print: "[4, 2, 3]".
/// ```
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
#[inline]
Expand Down

0 comments on commit d9c9c32

Please sign in to comment.