diff options
| author | bors <bors@rust-lang.org> | 2014-11-23 20:26:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-23 20:26:58 +0000 |
| commit | 4e5259503cd8aac9905c7ac6d68d0c4caab1d28c (patch) | |
| tree | 9d93d055fa5aa82480c4b5771aba4cca5efdfc9b /src/liballoc/boxed.rs | |
| parent | 220b99b148559e8996a1dbd279e8ca190bf94b2e (diff) | |
| parent | d6b023a46750d6c2df919908bd0f1460d3d9c8a6 (diff) | |
| download | rust-4e5259503cd8aac9905c7ac6d68d0c4caab1d28c.tar.gz rust-4e5259503cd8aac9905c7ac6d68d0c4caab1d28c.zip | |
auto merge of #19242 : jakub-/rust/roll-up, r=jakub-
Diffstat (limited to 'src/liballoc/boxed.rs')
| -rw-r--r-- | src/liballoc/boxed.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 26f8522e1c1..000dda59e3d 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -15,7 +15,6 @@ use core::clone::Clone; use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::default::Default; use core::fmt; -use core::intrinsics; use core::kinds::Sized; use core::mem; use core::option::Option; @@ -104,17 +103,14 @@ pub trait BoxAny { } #[stable] -impl BoxAny for Box<Any+'static> { +impl BoxAny for Box<Any> { #[inline] - fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any+'static>> { + 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); - - // Prevent destructor on self being run - intrinsics::forget(self); + mem::transmute::<Box<Any>, TraitObject>(self); // Extract the data pointer Ok(mem::transmute(to.data)) |
