about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorJakub Bukaj <jakub@jakub.cc>2014-11-23 14:11:58 -0500
committerJakub Bukaj <jakub@jakub.cc>2014-11-23 14:11:58 -0500
commit11700cb1d4442e8bdfded6edb51e060cf4d5563d (patch)
treeb24888bd3e79265ae85b9359f21b0b06b5281d41 /src/liballoc
parent4dbd6574b0d4825c7759e2b3755b5e0d6ac09233 (diff)
parent1b17eefa4aff87ae393c6d5aff7e90ff7c3c3185 (diff)
downloadrust-11700cb1d4442e8bdfded6edb51e060cf4d5563d.tar.gz
rust-11700cb1d4442e8bdfded6edb51e060cf4d5563d.zip
rollup merge of #19225: reem/any-unnecessary-transmute-copy
transmute_copy is no longer needed and is just slow.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs10
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))