Skip to content

Commit 993c148

Browse files
committed
add canonicalize method to InferCtxt [VIC]
1 parent 80b4c45 commit 993c148

File tree

28 files changed

+1121
-16
lines changed

28 files changed

+1121
-16
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use std::cell::RefCell;
1919
use std::hash as std_hash;
2020
use std::mem;
2121
use middle::region;
22+
use infer;
2223
use traits;
2324
use ty;
2425
use mir;
@@ -85,6 +86,9 @@ for ty::RegionKind {
8586
ty::ReEmpty => {
8687
// No variant fields to hash for these ...
8788
}
89+
ty::ReCanonical(c) => {
90+
c.hash_stable(hcx, hasher);
91+
}
8892
ty::ReLateBound(db, ty::BrAnon(i)) => {
8993
db.depth.hash_stable(hcx, hasher);
9094
i.hash_stable(hcx, hasher);
@@ -130,6 +134,16 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
130134
}
131135
}
132136

137+
impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::CanonicalVar {
138+
#[inline]
139+
fn hash_stable<W: StableHasherResult>(&self,
140+
hcx: &mut StableHashingContext<'gcx>,
141+
hasher: &mut StableHasher<W>) {
142+
use rustc_data_structures::indexed_vec::Idx;
143+
self.index().hash_stable(hcx, hasher);
144+
}
145+
}
146+
133147
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
134148
for ty::adjustment::AutoBorrow<'gcx> {
135149
fn hash_stable<W: StableHasherResult>(&self,
@@ -1229,11 +1243,52 @@ for traits::VtableGeneratorData<'gcx, N> where N: HashStable<StableHashingContex
12291243
}
12301244
}
12311245

1232-
impl<'gcx> HashStable<StableHashingContext<'gcx>>
1246+
impl<'a> HashStable<StableHashingContext<'a>>
12331247
for ty::UniverseIndex {
12341248
fn hash_stable<W: StableHasherResult>(&self,
1235-
hcx: &mut StableHashingContext<'gcx>,
1249+
hcx: &mut StableHashingContext<'a>,
12361250
hasher: &mut StableHasher<W>) {
12371251
self.depth().hash_stable(hcx, hasher);
12381252
}
12391253
}
1254+
1255+
impl_stable_hash_for!(
1256+
impl<'tcx, V> for struct infer::canonical::Canonical<'tcx, V> {
1257+
variables, value
1258+
}
1259+
);
1260+
1261+
impl_stable_hash_for!(
1262+
impl<'tcx> for struct infer::canonical::CanonicalVarValues<'tcx> {
1263+
var_values
1264+
}
1265+
);
1266+
1267+
impl_stable_hash_for!(struct infer::canonical::CanonicalVarInfo {
1268+
kind
1269+
});
1270+
1271+
impl_stable_hash_for!(enum infer::canonical::CanonicalVarKind {
1272+
Ty(k),
1273+
Region
1274+
});
1275+
1276+
impl_stable_hash_for!(enum infer::canonical::CanonicalTyVarKind {
1277+
General,
1278+
Int,
1279+
Float
1280+
});
1281+
1282+
impl_stable_hash_for!(
1283+
impl<'tcx, R> for struct infer::canonical::QueryResult<'tcx, R> {
1284+
var_values, region_constraints, certainty, value
1285+
}
1286+
);
1287+
1288+
impl_stable_hash_for!(struct infer::canonical::QueryRegionConstraints<'tcx> {
1289+
region_outlives, ty_outlives
1290+
});
1291+
1292+
impl_stable_hash_for!(enum infer::canonical::Certainty {
1293+
Proven, Ambiguous
1294+
});

0 commit comments

Comments
 (0)