From 07cfc252a1d34b25fcb6c84403071bd183794ae2 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Fri, 3 Oct 2014 10:46:41 -0700 Subject: [PATCH] Remove core::any::AnyPrivate [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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libcore/any.rs b/src/libcore/any.rs index fd5007ff415..c4b07d42e69 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -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 AnyPrivate for T { +impl Any for T { fn get_type_id(&self) -> TypeId { TypeId::of::() } } -impl Any for T {} - /////////////////////////////////////////////////////////////////////////////// // Extension methods for Any trait objects. // Implemented as three extension traits so that the methods can be generic.