@@ -81,28 +81,24 @@ pub trait Any: 'static {
8181 /// # Examples
8282 ///
8383 /// ```
84- /// #![feature(get_type_id)]
85- ///
8684 /// use std::any::{Any, TypeId};
8785 ///
8886 /// fn is_string(s: &dyn Any) -> bool {
89- /// TypeId::of::<String>() == s.get_type_id ()
87+ /// TypeId::of::<String>() == s.type_id ()
9088 /// }
9189 ///
9290 /// fn main() {
9391 /// assert_eq!(is_string(&0), false);
9492 /// assert_eq!(is_string(&"cookie monster".to_string()), true);
9593 /// }
9694 /// ```
97- #[ unstable( feature = "get_type_id" ,
98- reason = "this method will likely be replaced by an associated static" ,
99- issue = "27745" ) ]
100- fn get_type_id ( & self ) -> TypeId ;
95+ #[ stable( feature = "get_type_id" , since = "1.34.0" ) ]
96+ fn type_id ( & self ) -> TypeId ;
10197}
10298
10399#[ stable( feature = "rust1" , since = "1.0.0" ) ]
104100impl < T : ' static + ?Sized > Any for T {
105- fn get_type_id ( & self ) -> TypeId { TypeId :: of :: < T > ( ) }
101+ fn type_id ( & self ) -> TypeId { TypeId :: of :: < T > ( ) }
106102}
107103
108104///////////////////////////////////////////////////////////////////////////////
@@ -161,10 +157,10 @@ impl dyn Any {
161157 let t = TypeId :: of :: < T > ( ) ;
162158
163159 // Get TypeId of the type in the trait object
164- let boxed = self . get_type_id ( ) ;
160+ let concrete = self . type_id ( ) ;
165161
166162 // Compare both TypeIds on equality
167- t == boxed
163+ t == concrete
168164 }
169165
170166 /// Returns some reference to the boxed value if it is of type `T`, or
0 commit comments