about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-03-31 10:15:32 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-03-31 15:49:11 -0700
commitd03120afd36f9e3f4c1305e9e5ca0d24a3b4a32f (patch)
treef0eaf7535052e2be593c04d55b42ba1c019497c9 /src/liballoc
parent890f0ab10a81720606805db36628f61f29d0e816 (diff)
parentf19e763e0824a73118ed715f526cb7bdd584d4c4 (diff)
downloadrust-d03120afd36f9e3f4c1305e9e5ca0d24a3b4a32f.tar.gz
rust-d03120afd36f9e3f4c1305e9e5ca0d24a3b4a32f.zip
rollup merge of #23876: alexcrichton/stabilize-any
This commit stabilizes the following APIs:

* `TypeId::of` - now that it has an `Any` bound it's ready to be stable.
* `Box<Any>::downcast` - now that an inherent impl on `Box<Any>` as well as
  `Box<Any+Send>` is allowed the `BoxAny` trait is removed in favor of these
  inherent methods.

This is a breaking change due to the removal of the `BoxAny` trait, but
consumers can simply remove imports to fix crates.

[breaking-change]
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs26
-rw-r--r--src/liballoc/boxed_test.rs1
2 files changed, 6 insertions, 21 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index f9bd0ab2f1e..48dce3d8815 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -233,24 +233,10 @@ impl<T: ?Sized + Hash> Hash for Box<T> {
     }
 }
 
-/// Extension methods for an owning `Any` trait object.
-#[unstable(feature = "alloc",
-           reason = "this trait will likely disappear once compiler bugs blocking \
-                     a direct impl on `Box<Any>` have been fixed ")]
-// FIXME(#18737): this should be a direct impl on `Box<Any>`. If you're
-//                removing this please make sure that you can downcase on
-//                `Box<Any + Send>` as well as `Box<Any>`
-pub trait BoxAny {
-    /// Returns the boxed value if it is of type `T`, or
-    /// `Err(Self)` if it isn't.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>>;
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl BoxAny for Box<Any> {
+impl Box<Any> {
     #[inline]
-    fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
         if self.is::<T>() {
             unsafe {
                 // Get the raw representation of the trait object
@@ -267,10 +253,10 @@ impl BoxAny for Box<Any> {
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
-impl BoxAny for Box<Any+Send> {
+impl Box<Any+Send> {
     #[inline]
-    fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
         <Box<Any>>::downcast(self)
     }
 }
diff --git a/src/liballoc/boxed_test.rs b/src/liballoc/boxed_test.rs
index bb1ff9428a7..682d5f407c4 100644
--- a/src/liballoc/boxed_test.rs
+++ b/src/liballoc/boxed_test.rs
@@ -17,7 +17,6 @@ use core::clone::Clone;
 
 use std::boxed;
 use std::boxed::Box;
-use std::boxed::BoxAny;
 
 #[test]
 fn test_owned_clone() {