diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 7e1359d5c1201..fe9100e8a5cc6 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -200,8 +200,7 @@ extern "rust-intrinsic" { /// Gets an identifier which is globally unique to the specified type. This /// function will return the same value for a type regardless of whichever /// crate it is invoked in. - pub fn type_id() -> TypeId; - + pub fn type_id() -> TypeId; /// Create a value initialized to zero. /// @@ -552,8 +551,9 @@ pub struct TypeId { impl TypeId { /// Returns the `TypeId` of the type this generic function has been instantiated with - pub fn of() -> TypeId { + pub fn of() -> TypeId { unsafe { type_id::() } } + pub fn hash(&self) -> u64 { self.t } }