]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/mod.rs
Distinguish between placeholder kinds
[rust.git] / src / librustc / ty / mod.rs
index ad200449f8907dda9adb00be03bb31e0b7044499..4372beafa6488d9eb877c5aca9aaf455d62bb07a 100644 (file)
@@ -1587,12 +1587,27 @@ pub fn cannot_name(self, other: UniverseIndex) -> bool {
 /// universe are just two regions with an unknown relationship to one
 /// another.
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, PartialOrd, Ord)]
-pub struct Placeholder {
+pub struct Placeholder<T> {
     pub universe: UniverseIndex,
-    pub name: BoundRegion,
+    pub name: T,
 }
 
-impl_stable_hash_for!(struct Placeholder { universe, name });
+impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for Placeholder<T>
+    where T: HashStable<StableHashingContext<'a>>
+{
+    fn hash_stable<W: StableHasherResult>(
+        &self,
+        hcx: &mut StableHashingContext<'a>,
+        hasher: &mut StableHasher<W>
+    ) {
+        self.universe.hash_stable(hcx, hasher);
+        self.name.hash_stable(hcx, hasher);
+    }
+}
+
+pub type PlaceholderRegion = Placeholder<BoundRegion>;
+
+pub type PlaceholderType = Placeholder<BoundVar>;
 
 /// When type checking, we use the `ParamEnv` to track
 /// details about the set of where-clauses that are in scope at this