diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2018-05-23 22:38:22 -0700 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-08-29 10:10:58 +0200 |
| commit | 9f5a3cccb8a2ca59ea43421d357bf57dd954249c (patch) | |
| tree | 940a71f9262298671bd32d2a4af293cb9cf1acc6 /src/libcore | |
| parent | da58bebf01b1213cde5490adc5c476f87c3ae423 (diff) | |
| download | rust-9f5a3cccb8a2ca59ea43421d357bf57dd954249c.tar.gz rust-9f5a3cccb8a2ca59ea43421d357bf57dd954249c.zip | |
Fix failing doctests
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 2 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index fc996b36779..1c400cbdfcb 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1149,7 +1149,7 @@ extern "rust-intrinsic" { /// Creating an invalid value: /// /// ```no_run - /// use std::{mem, ptr}; + /// use std::ptr; /// /// let mut v = Box::new(0i32); /// diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 3faadca3f39..eaff3093767 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -396,7 +396,7 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T { /// ``` /// use std::ptr; /// -/// let mut s = String::new("foo"); +/// let mut s = String::from("foo"); /// unsafe { /// // `s2` now points to the same underlying memory as `s1`. /// let mut s2 = ptr::read(&s); @@ -410,10 +410,10 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T { /// /// // Assigning to `s` would cause the old value to be dropped again, /// // resulting in undefined behavior. -/// // s = String::new("bar"); // ERROR +/// // s = String::from("bar"); // ERROR /// /// // `ptr::write` can be used to overwrite a value without dropping it. -/// ptr::write(&s, String::new("bar")); +/// ptr::write(&mut s, String::from("bar")); /// } /// /// assert_eq!(s, "bar"); |
