diff options
| author | bors <bors@rust-lang.org> | 2016-08-27 03:07:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-27 03:07:48 -0700 |
| commit | 099b9fdb1a170b57ffd7174b3c3042cc86b7fe91 (patch) | |
| tree | aa3b27019254450634a4fea8583e7cc70d7b7190 /src/liballoc/boxed.rs | |
| parent | 6b74503aa4f2fb4035d9adef9391e9b9658c57ad (diff) | |
| parent | 668d63132e23999f5a74fe65c8c0590a4d9ca215 (diff) | |
| download | rust-099b9fdb1a170b57ffd7174b3c3042cc86b7fe91.tar.gz rust-099b9fdb1a170b57ffd7174b3c3042cc86b7fe91.zip | |
Auto merge of #36030 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests - Successful merges: #35124, #35877, #35953, #36002, #36004, #36005, #36014 - Failed merges:
Diffstat (limited to 'src/liballoc/boxed.rs')
| -rw-r--r-- | src/liballoc/boxed.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index dae12f6e8bd..c8a78f84f18 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -67,7 +67,6 @@ use core::mem; use core::ops::{CoerceUnsized, Deref, DerefMut}; use core::ops::{BoxPlace, Boxed, InPlace, Place, Placer}; use core::ptr::{self, Unique}; -use core::raw::TraitObject; use core::convert::From; /// A value that represents the heap. This is the default place that the `box` @@ -428,12 +427,8 @@ impl Box<Any> { pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> { if self.is::<T>() { unsafe { - // Get the raw representation of the trait object - let raw = Box::into_raw(self); - let to: TraitObject = mem::transmute::<*mut Any, TraitObject>(raw); - - // Extract the data pointer - Ok(Box::from_raw(to.data as *mut T)) + let raw: *mut Any = Box::into_raw(self); + Ok(Box::from_raw(raw as *mut T)) } } else { Err(self) |
