diff options
| author | bors <bors@rust-lang.org> | 2019-01-24 01:24:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-24 01:24:13 +0000 |
| commit | cd3d580d59e8af62fb8fc25b996900dd5ccd5ad9 (patch) | |
| tree | bdd151640dbbe35520823f2a649f56b24d8336e2 /src/libcore | |
| parent | 19f8958f827e379be9b0ffc93fca580ec8ffac77 (diff) | |
| parent | e90cdfd50768feb612dcea84ea25a725c72df39a (diff) | |
| download | rust-cd3d580d59e8af62fb8fc25b996900dd5ccd5ad9.tar.gz rust-cd3d580d59e8af62fb8fc25b996900dd5ccd5ad9.zip | |
Auto merge of #57869 - Centril:rollup, r=Centril
Rollup of 11 pull requests Successful merges: - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage) - #57730 (Merge visitors in AST validation) - #57779 (Recover from parse errors in literal struct fields and incorrect float literals) - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`) - #57795 (Use structured suggestion in stead of notes) - #57817 (Add error for trailing angle brackets.) - #57834 (Stabilize Any::get_type_id and rename to type_id) - #57836 (Fix some cross crate existential type ICEs) - #57840 (Fix issue 57762) - #57844 (use port 80 for retrieving GPG key) - #57858 (Ignore line ending on older git versions) Failed merges: r? @ghost
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/any.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 6a863ff369a..2afd9e0c072 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -81,12 +81,10 @@ pub trait Any: 'static { /// # Examples /// /// ``` - /// #![feature(get_type_id)] - /// /// use std::any::{Any, TypeId}; /// /// fn is_string(s: &dyn Any) -> bool { - /// TypeId::of::<String>() == s.get_type_id() + /// TypeId::of::<String>() == s.type_id() /// } /// /// fn main() { @@ -94,15 +92,13 @@ pub trait Any: 'static { /// assert_eq!(is_string(&"cookie monster".to_string()), true); /// } /// ``` - #[unstable(feature = "get_type_id", - reason = "this method will likely be replaced by an associated static", - issue = "27745")] - fn get_type_id(&self) -> TypeId; + #[stable(feature = "get_type_id", since = "1.34.0")] + fn type_id(&self) -> TypeId; } #[stable(feature = "rust1", since = "1.0.0")] impl<T: 'static + ?Sized > Any for T { - fn get_type_id(&self) -> TypeId { TypeId::of::<T>() } + fn type_id(&self) -> TypeId { TypeId::of::<T>() } } /////////////////////////////////////////////////////////////////////////////// @@ -161,10 +157,10 @@ impl dyn Any { let t = TypeId::of::<T>(); // Get TypeId of the type in the trait object - let boxed = self.get_type_id(); + let concrete = self.type_id(); // Compare both TypeIds on equality - t == boxed + t == concrete } /// Returns some reference to the boxed value if it is of type `T`, or |
