diff options
| author | Ms2ger <ms2ger@gmail.com> | 2015-06-26 22:29:40 +0200 |
|---|---|---|
| committer | Ms2ger <ms2ger@gmail.com> | 2015-06-26 22:29:40 +0200 |
| commit | 532235be276de640d22c9d974d81f723e6094cf1 (patch) | |
| tree | b681d35ab0de0226fcc1c9574bd5dacd8adf45f1 /src/liballoc | |
| parent | 2cb8a31e7cea1ee499630c9c6744dedd0c0b371f (diff) | |
| download | rust-532235be276de640d22c9d974d81f723e6094cf1.tar.gz rust-532235be276de640d22c9d974d81f723e6094cf1.zip | |
Use Box::into_raw rather than the deprecated boxed::into_raw in tests and documentation.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 6 | ||||
| -rw-r--r-- | src/liballoc/boxed_test.rs | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 1039756363e..c941629b871 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -116,7 +116,7 @@ impl<T : ?Sized> Box<T> { /// of `T` and releases memory. Since the way `Box` allocates and /// releases memory is unspecified, the only valid pointer to pass /// to this function is the one taken from another `Box` with - /// `boxed::into_raw` function. + /// `Box::into_raw` function. /// /// Function is unsafe, because improper use of this function may /// lead to memory problems like double-free, for example if the @@ -140,10 +140,8 @@ impl<T : ?Sized> Box<T> { /// # Examples /// ``` /// # #![feature(box_raw)] - /// use std::boxed; - /// /// let seventeen = Box::new(17u32); - /// let raw = boxed::into_raw(seventeen); + /// let raw = Box::into_raw(seventeen); /// let boxed_again = unsafe { Box::from_raw(raw) }; /// ``` #[unstable(feature = "box_raw", reason = "may be renamed")] diff --git a/src/liballoc/boxed_test.rs b/src/liballoc/boxed_test.rs index fc44ac4eac6..2ef23b26a56 100644 --- a/src/liballoc/boxed_test.rs +++ b/src/liballoc/boxed_test.rs @@ -76,9 +76,9 @@ fn deref() { #[test] fn raw_sized() { + let x = Box::new(17); + let p = Box::into_raw(x); unsafe { - let x = Box::new(17); - let p = boxed::into_raw(x); assert_eq!(17, *p); *p = 19; let y = Box::from_raw(p); @@ -105,9 +105,9 @@ fn raw_trait() { } } + let x: Box<Foo> = Box::new(Bar(17)); + let p = Box::into_raw(x); unsafe { - let x: Box<Foo> = Box::new(Bar(17)); - let p = boxed::into_raw(x); assert_eq!(17, (*p).get()); (*p).set(19); let y: Box<Foo> = Box::from_raw(p); |
