]> git.lizzy.rs Git - rust.git/commitdiff
Remove the unneeded Sized bound on TypeId creation
authorJonathan Reem <jonathan.reem@gmail.com>
Tue, 6 Jan 2015 21:59:07 +0000 (22:59 +0100)
committerJonathan Reem <jonathan.reem@gmail.com>
Tue, 6 Jan 2015 21:59:07 +0000 (22:59 +0100)
This bound is probably unintentional and is unnecessarily
constricting.

src/libcore/intrinsics.rs

index 7e1359d5c12013cbe2be42332571d970c69034c7..fe9100e8a5cc6b78c20ba10ca79787122499443a 100644 (file)
@@ -200,8 +200,7 @@ pub struct TyDesc {
     /// 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<T: 'static>() -> TypeId;
-
+    pub fn type_id<T: ?Sized + 'static>() -> 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<T: 'static>() -> TypeId {
+    pub fn of<T: ?Sized + 'static>() -> TypeId {
         unsafe { type_id::<T>() }
     }
+
     pub fn hash(&self) -> u64 { self.t }
 }