diff options
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 41541619945..5f8789bf1c7 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -113,28 +113,9 @@ impl<S: hash::Writer, Sized? T: Hash<S>> Hash<S> for Box<T> { } } -#[cfg(not(stage0))] -impl Box<Any> { - pub fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> { - if self.is::<T>() { - unsafe { - // Get the raw representation of the trait object - let to: TraitObject = - mem::transmute::<Box<Any>, TraitObject>(self); - - // Extract the data pointer - Ok(mem::transmute(to.data)) - } - } else { - Err(self) - } - } -} - /// Extension methods for an owning `Any` trait object. #[unstable = "post-DST and coherence changes, this will not be a trait but \ rather a direct `impl` on `Box<Any>`"] -#[cfg(stage0)] pub trait BoxAny { /// Returns the boxed value if it is of type `T`, or /// `Err(Self)` if it isn't. @@ -142,10 +123,10 @@ pub trait BoxAny { fn downcast<T: 'static>(self) -> Result<Box<T>, Self>; } -#[stable] -#[cfg(stage0)] impl BoxAny for Box<Any> { #[inline] + #[unstable = "method may be renamed with respect to other downcasting \ + methods"] fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> { if self.is::<T>() { unsafe { |
