diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-02 09:24:56 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-02 10:50:13 -0800 |
| commit | e921e3f04513ffb094208a538a2835d4dc77b991 (patch) | |
| tree | 0fc18976815572ac2f9cab2e01236243e684eb4d /src/liballoc/boxed.rs | |
| parent | 1f2ead1629ce544d98f35225061d216abd86d5a6 (diff) | |
| download | rust-e921e3f04513ffb094208a538a2835d4dc77b991.tar.gz rust-e921e3f04513ffb094208a538a2835d4dc77b991.zip | |
Rollup test fixes and rebase conflicts
Diffstat (limited to 'src/liballoc/boxed.rs')
| -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 { |
