about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-07 03:27:12 +0000
committerbors <bors@rust-lang.org>2014-10-07 03:27:12 +0000
commit8d702167ba6af50c64683685bae4956cb094a23a (patch)
treee9eab7a42630939fd6640bad41b0ecded7076d5d
parentb5ba2f5517b1f90d07969ca3facdf5132e42436c (diff)
parentd007d44dad08aa4239a2e85ce00a0466f32a4440 (diff)
downloadrust-8d702167ba6af50c64683685bae4956cb094a23a.tar.gz
rust-8d702167ba6af50c64683685bae4956cb094a23a.zip
auto merge of #17745 : aturon/rust/revert-any-private, r=alexcrichton
[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]
-rw-r--r--src/libcore/any.rs9
-rw-r--r--src/test/compile-fail/issue-14366.rs2
2 files changed, 2 insertions, 9 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<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.
diff --git a/src/test/compile-fail/issue-14366.rs b/src/test/compile-fail/issue-14366.rs
index ceb6daac65e..a0eca1d49dc 100644
--- a/src/test/compile-fail/issue-14366.rs
+++ b/src/test/compile-fail/issue-14366.rs
@@ -12,6 +12,4 @@ fn main() {
     let _x = "test" as &::std::any::Any;
 //~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `str`
 //~^^ NOTE the trait `core::kinds::Sized` must be implemented for the cast to the object type
-//~^^^ ERROR the trait `core::kinds::Sized` is not implemented for the type `str`
-//~^^^^ NOTE the trait `core::kinds::Sized` must be implemented for the cast to the object type
 }