]> git.lizzy.rs Git - rust.git/commitdiff
Remove core::any::AnyPrivate
authorAaron Turon <aturon@mozilla.com>
Fri, 3 Oct 2014 17:46:41 +0000 (10:46 -0700)
committerAaron Turon <aturon@mozilla.com>
Mon, 6 Oct 2014 23:32:30 +0000 (16:32 -0700)
[Previously](https://github.com/rust-lang/rust/commit/e5da6a71a6a0b46dd3630fc8326e6d5906a1fde6),
the `Any` trait was split into a private portion and an (empty) public
portion, in order to hide the implementation strategy used for
downcasting. However, the [new
rules](https://github.com/rust-lang/rust/commit/e9ad12c0cae5c43ada6641c7dc840a0fbe5010a2)
for privacy forbid `AnyPrivate` from actually being private.

This patch thus reverts the introduction of `AnyPrivate`.

Although this is unlikely to break any real code, it removes a public
trait and is therefore a:

[breaking-change]

src/libcore/any.rs

index fd5007ff415f0869186b58c57a742ac0d9114433..c4b07d42e693afbf953a85c2c55ae0cc0113e883 100644 (file)
@@ -91,20 +91,15 @@ pub enum Void { }
 /// Every type with no non-`'static` references implements `Any`, so `Any` can
 /// be used as a trait object to emulate the effects dynamic typing.
 #[stable]
-pub trait Any: AnyPrivate + 'static {}
-
-/// An inner trait to ensure that only this module can call `get_type_id()`.
-pub trait AnyPrivate {
+pub trait Any: 'static {
     /// Get the `TypeId` of `self`
     fn get_type_id(&self) -> TypeId;
 }
 
-impl<T: 'static> AnyPrivate for T {
+impl<T: 'static> Any for T {
     fn get_type_id(&self) -> TypeId { TypeId::of::<T>() }
 }
 
-impl<T: 'static + AnyPrivate> Any for T {}
-
 ///////////////////////////////////////////////////////////////////////////////
 // Extension methods for Any trait objects.
 // Implemented as three extension traits so that the methods can be generic.