Skip to content

Commit 07cfc25

Browse files
committed
Remove core::any::AnyPrivate
[Previously](e5da6a7), 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](e9ad12c) 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]
1 parent b5ba2f5 commit 07cfc25

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/libcore/any.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,15 @@ pub enum Void { }
9191
/// Every type with no non-`'static` references implements `Any`, so `Any` can
9292
/// be used as a trait object to emulate the effects dynamic typing.
9393
#[stable]
94-
pub trait Any: AnyPrivate + 'static {}
95-
96-
/// An inner trait to ensure that only this module can call `get_type_id()`.
97-
pub trait AnyPrivate {
94+
pub trait Any: 'static {
9895
/// Get the `TypeId` of `self`
9996
fn get_type_id(&self) -> TypeId;
10097
}
10198

102-
impl<T: 'static> AnyPrivate for T {
99+
impl<T: 'static> Any for T {
103100
fn get_type_id(&self) -> TypeId { TypeId::of::<T>() }
104101
}
105102

106-
impl<T: 'static + AnyPrivate> Any for T {}
107-
108103
///////////////////////////////////////////////////////////////////////////////
109104
// Extension methods for Any trait objects.
110105
// Implemented as three extension traits so that the methods can be generic.

0 commit comments

Comments
 (0)