Skip to content

Commit d07dd4a

Browse files
Implement HashStable for Xyz<'gcx> instead of Xyz<'lcx>.
1 parent bcd75d6 commit d07dd4a

File tree

4 files changed

+40
-34
lines changed

4 files changed

+40
-34
lines changed

src/librustc/ich/impls_mir.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref });
3333
impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup });
3434

3535
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
36-
for mir::Terminator<'tcx> {
36+
for mir::Terminator<'gcx> {
3737
#[inline]
3838
fn hash_stable<W: StableHasherResult>(&self,
3939
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
@@ -125,7 +125,7 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::P
125125
}
126126

127127
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
128-
for mir::TerminatorKind<'tcx> {
128+
for mir::TerminatorKind<'gcx> {
129129
fn hash_stable<W: StableHasherResult>(&self,
130130
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
131131
hasher: &mut StableHasher<W>) {
@@ -186,7 +186,7 @@ for mir::TerminatorKind<'tcx> {
186186
}
187187

188188
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
189-
for mir::AssertMessage<'tcx> {
189+
for mir::AssertMessage<'gcx> {
190190
fn hash_stable<W: StableHasherResult>(&self,
191191
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
192192
hasher: &mut StableHasher<W>) {
@@ -207,7 +207,7 @@ for mir::AssertMessage<'tcx> {
207207
impl_stable_hash_for!(struct mir::Statement<'tcx> { source_info, kind });
208208

209209
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
210-
for mir::StatementKind<'tcx> {
210+
for mir::StatementKind<'gcx> {
211211
fn hash_stable<W: StableHasherResult>(&self,
212212
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
213213
hasher: &mut StableHasher<W>) {
@@ -244,7 +244,7 @@ for mir::StatementKind<'tcx> {
244244
}
245245

246246
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
247-
for mir::ValidationOperand<'tcx, T>
247+
for mir::ValidationOperand<'gcx, T>
248248
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
249249
{
250250
fn hash_stable<W: StableHasherResult>(&self,
@@ -260,7 +260,7 @@ impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
260260

261261
impl_stable_hash_for!(enum mir::ValidationOp { Acquire, Release, Suspend(extent) });
262262

263-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Lvalue<'tcx> {
263+
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Lvalue<'gcx> {
264264
fn hash_stable<W: StableHasherResult>(&self,
265265
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
266266
hasher: &mut StableHasher<W>) {
@@ -280,7 +280,7 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::L
280280
}
281281

282282
impl<'a, 'gcx, 'tcx, B, V, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
283-
for mir::Projection<'tcx, B, V, T>
283+
for mir::Projection<'gcx, B, V, T>
284284
where B: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>,
285285
V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>,
286286
T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
@@ -299,7 +299,7 @@ for mir::Projection<'tcx, B, V, T>
299299
}
300300

301301
impl<'a, 'gcx, 'tcx, V, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
302-
for mir::ProjectionElem<'tcx, V, T>
302+
for mir::ProjectionElem<'gcx, V, T>
303303
where V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>,
304304
T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
305305
{
@@ -335,7 +335,7 @@ for mir::ProjectionElem<'tcx, V, T>
335335

336336
impl_stable_hash_for!(struct mir::VisibilityScopeData { span, parent_scope });
337337

338-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Operand<'tcx> {
338+
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Operand<'gcx> {
339339
fn hash_stable<W: StableHasherResult>(&self,
340340
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
341341
hasher: &mut StableHasher<W>) {
@@ -352,7 +352,7 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::O
352352
}
353353
}
354354

355-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Rvalue<'tcx> {
355+
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Rvalue<'gcx> {
356356
fn hash_stable<W: StableHasherResult>(&self,
357357
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
358358
hasher: &mut StableHasher<W>) {
@@ -413,7 +413,7 @@ impl_stable_hash_for!(enum mir::CastKind {
413413
});
414414

415415
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
416-
for mir::AggregateKind<'tcx> {
416+
for mir::AggregateKind<'gcx> {
417417
fn hash_stable<W: StableHasherResult>(&self,
418418
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
419419
hasher: &mut StableHasher<W>) {
@@ -469,7 +469,7 @@ impl_stable_hash_for!(enum mir::NullOp {
469469

470470
impl_stable_hash_for!(struct mir::Constant<'tcx> { span, ty, literal });
471471

472-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Literal<'tcx> {
472+
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::Literal<'gcx> {
473473
fn hash_stable<W: StableHasherResult>(&self,
474474
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
475475
hasher: &mut StableHasher<W>) {

src/librustc/ich/impls_ty.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use syntax_pos::symbol::InternedString;
2020
use ty;
2121

2222
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
23-
for &'tcx ty::Slice<T>
23+
for &'gcx ty::Slice<T>
2424
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> {
2525
fn hash_stable<W: StableHasherResult>(&self,
2626
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
@@ -30,7 +30,7 @@ for &'tcx ty::Slice<T>
3030
}
3131

3232
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
33-
for ty::subst::Kind<'tcx> {
33+
for ty::subst::Kind<'gcx> {
3434
fn hash_stable<W: StableHasherResult>(&self,
3535
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
3636
hasher: &mut StableHasher<W>) {
@@ -55,6 +55,11 @@ for ty::RegionKind {
5555
db.depth.hash_stable(hcx, hasher);
5656
i.hash_stable(hcx, hasher);
5757
}
58+
ty::ReLateBound(db, ty::BrNamed(def_id, name)) => {
59+
db.depth.hash_stable(hcx, hasher);
60+
def_id.hash_stable(hcx, hasher);
61+
name.hash_stable(hcx, hasher);
62+
}
5863
ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }) => {
5964
def_id.hash_stable(hcx, hasher);
6065
index.hash_stable(hcx, hasher);
@@ -76,7 +81,7 @@ for ty::RegionKind {
7681
}
7782

7883
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
79-
for ty::adjustment::AutoBorrow<'tcx> {
84+
for ty::adjustment::AutoBorrow<'gcx> {
8085
fn hash_stable<W: StableHasherResult>(&self,
8186
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
8287
hasher: &mut StableHasher<W>) {
@@ -94,7 +99,7 @@ for ty::adjustment::AutoBorrow<'tcx> {
9499
}
95100

96101
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
97-
for ty::adjustment::Adjust<'tcx> {
102+
for ty::adjustment::Adjust<'gcx> {
98103
fn hash_stable<W: StableHasherResult>(&self,
99104
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
100105
hasher: &mut StableHasher<W>) {
@@ -128,7 +133,7 @@ impl_stable_hash_for!(enum ty::BorrowKind {
128133
});
129134

130135
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
131-
for ty::UpvarCapture<'tcx> {
136+
for ty::UpvarCapture<'gcx> {
132137
fn hash_stable<W: StableHasherResult>(&self,
133138
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
134139
hasher: &mut StableHasher<W>) {
@@ -150,12 +155,13 @@ impl_stable_hash_for!(struct ty::FnSig<'tcx> {
150155
});
151156

152157
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Binder<T>
153-
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>> + ty::fold::TypeFoldable<'tcx>
158+
where T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
154159
{
155160
fn hash_stable<W: StableHasherResult>(&self,
156161
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
157162
hasher: &mut StableHasher<W>) {
158-
hcx.tcx().anonymize_late_bound_regions(self).0.hash_stable(hcx, hasher);
163+
let ty::Binder(ref inner) = *self;
164+
inner.hash_stable(hcx, hasher);
159165
}
160166
}
161167

@@ -190,7 +196,7 @@ impl_stable_hash_for!(struct ty::ProjectionPredicate<'tcx> { projection_ty, ty }
190196
impl_stable_hash_for!(struct ty::ProjectionTy<'tcx> { substs, item_def_id });
191197

192198

193-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Predicate<'tcx> {
199+
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::Predicate<'gcx> {
194200
fn hash_stable<W: StableHasherResult>(&self,
195201
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
196202
hasher: &mut StableHasher<W>) {
@@ -256,7 +262,7 @@ impl_stable_hash_for!(struct ty::FieldDef {
256262
});
257263

258264
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
259-
for ::middle::const_val::ConstVal<'tcx> {
265+
for ::middle::const_val::ConstVal<'gcx> {
260266
fn hash_stable<W: StableHasherResult>(&self,
261267
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
262268
hasher: &mut StableHasher<W>) {
@@ -483,7 +489,7 @@ impl_stable_hash_for!(enum ty::BoundRegion {
483489
});
484490

485491
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
486-
for ty::TypeVariants<'tcx>
492+
for ty::TypeVariants<'gcx>
487493
{
488494
fn hash_stable<W: StableHasherResult>(&self,
489495
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
@@ -574,7 +580,7 @@ impl_stable_hash_for!(struct ty::TypeAndMut<'tcx> {
574580
});
575581

576582
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
577-
for ty::ExistentialPredicate<'tcx>
583+
for ty::ExistentialPredicate<'gcx>
578584
{
579585
fn hash_stable<W: StableHasherResult>(&self,
580586
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
@@ -607,7 +613,7 @@ impl_stable_hash_for!(struct ty::ExistentialProjection<'tcx> {
607613

608614

609615
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
610-
for ty::TypeckTables<'tcx> {
616+
for ty::TypeckTables<'gcx> {
611617
fn hash_stable<W: StableHasherResult>(&self,
612618
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
613619
hasher: &mut StableHasher<W>) {
@@ -689,7 +695,7 @@ impl_stable_hash_for!(struct ty::Instance<'tcx> {
689695
substs
690696
});
691697

692-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::InstanceDef<'tcx> {
698+
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::InstanceDef<'gcx> {
693699
fn hash_stable<W: StableHasherResult>(&self,
694700
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
695701
hasher: &mut StableHasher<W>) {

src/librustc/macros.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ macro_rules! __impl_stable_hash_field {
7373
#[macro_export]
7474
macro_rules! impl_stable_hash_for {
7575
(enum $enum_name:path { $( $variant:ident $( ( $($arg:ident),* ) )* ),* }) => {
76-
impl<'a, 'gcx, 'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'gcx, 'tcx>> for $enum_name {
76+
impl<'a, 'tcx, 'lcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'tcx, 'lcx>> for $enum_name {
7777
#[inline]
7878
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
79-
__ctx: &mut $crate::ich::StableHashingContext<'a, 'gcx, 'tcx>,
79+
__ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>,
8080
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
8181
use $enum_name::*;
8282
::std::mem::discriminant(self).hash_stable(__ctx, __hasher);
@@ -92,10 +92,10 @@ macro_rules! impl_stable_hash_for {
9292
}
9393
};
9494
(struct $struct_name:path { $($field:ident),* }) => {
95-
impl<'a, 'gcx, 'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'gcx, 'tcx>> for $struct_name {
95+
impl<'a, 'tcx, 'lcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'tcx, 'lcx>> for $struct_name {
9696
#[inline]
9797
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
98-
__ctx: &mut $crate::ich::StableHashingContext<'a, 'gcx, 'tcx>,
98+
__ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>,
9999
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
100100
let $struct_name {
101101
$(ref $field),*
@@ -106,10 +106,10 @@ macro_rules! impl_stable_hash_for {
106106
}
107107
};
108108
(tuple_struct $struct_name:path { $($field:ident),* }) => {
109-
impl<'a, 'gcx, 'tcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'gcx, 'tcx>> for $struct_name {
109+
impl<'a, 'tcx, 'lcx> ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a, 'tcx, 'lcx>> for $struct_name {
110110
#[inline]
111111
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
112-
__ctx: &mut $crate::ich::StableHashingContext<'a, 'gcx, 'tcx>,
112+
__ctx: &mut $crate::ich::StableHashingContext<'a, 'tcx, 'lcx>,
113113
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
114114
let $struct_name (
115115
$(ref $field),*
@@ -125,11 +125,11 @@ macro_rules! impl_stable_hash_for {
125125
macro_rules! impl_stable_hash_for_spanned {
126126
($T:path) => (
127127

128-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ::syntax::codemap::Spanned<$T>
128+
impl<'a, 'tcx, 'lcx> HashStable<StableHashingContext<'a, 'tcx, 'lcx>> for ::syntax::codemap::Spanned<$T>
129129
{
130130
#[inline]
131131
fn hash_stable<W: StableHasherResult>(&self,
132-
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
132+
hcx: &mut StableHashingContext<'a, 'tcx, 'lcx>,
133133
hasher: &mut StableHasher<W>) {
134134
self.node.hash_stable(hcx, hasher);
135135
self.span.hash_stable(hcx, hasher);

src/librustc/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ impl<'tcx> TyS<'tcx> {
497497
}
498498
}
499499

500-
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::TyS<'tcx> {
500+
impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for ty::TyS<'gcx> {
501501
fn hash_stable<W: StableHasherResult>(&self,
502502
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
503503
hasher: &mut StableHasher<W>) {

0 commit comments

Comments
 (0)