We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6539cb4 commit 2404232Copy full SHA for 2404232
src/libcore/intrinsics.rs
@@ -200,8 +200,7 @@ extern "rust-intrinsic" {
200
/// Gets an identifier which is globally unique to the specified type. This
201
/// function will return the same value for a type regardless of whichever
202
/// crate it is invoked in.
203
- pub fn type_id<T: 'static>() -> TypeId;
204
-
+ pub fn type_id<T: ?Sized + 'static>() -> TypeId;
205
206
/// Create a value initialized to zero.
207
///
@@ -552,8 +551,9 @@ pub struct TypeId {
552
551
553
impl TypeId {
554
/// Returns the `TypeId` of the type this generic function has been instantiated with
555
- pub fn of<T: 'static>() -> TypeId {
+ pub fn of<T: ?Sized + 'static>() -> TypeId {
556
unsafe { type_id::<T>() }
557
}
+
558
pub fn hash(&self) -> u64 { self.t }
559
0 commit comments