@@ -246,7 +246,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
246
246
// after producing an error for each of them.
247
247
let definition_ty = instantiated_ty. ty . fold_with ( & mut ReverseMapper :: new (
248
248
self . tcx ,
249
- def_id ,
249
+ opaque_type_key ,
250
250
map,
251
251
instantiated_ty. ty ,
252
252
instantiated_ty. span ,
@@ -429,7 +429,7 @@ fn check_opaque_type_parameter_valid(
429
429
struct ReverseMapper < ' tcx > {
430
430
tcx : TyCtxt < ' tcx > ,
431
431
432
- opaque_type_def_id : LocalDefId ,
432
+ key : ty :: OpaqueTypeKey < ' tcx > ,
433
433
map : FxHashMap < GenericArg < ' tcx > , GenericArg < ' tcx > > ,
434
434
map_missing_regions_to_empty : bool ,
435
435
@@ -443,14 +443,14 @@ struct ReverseMapper<'tcx> {
443
443
impl < ' tcx > ReverseMapper < ' tcx > {
444
444
fn new (
445
445
tcx : TyCtxt < ' tcx > ,
446
- opaque_type_def_id : LocalDefId ,
446
+ key : ty :: OpaqueTypeKey < ' tcx > ,
447
447
map : FxHashMap < GenericArg < ' tcx > , GenericArg < ' tcx > > ,
448
448
hidden_ty : Ty < ' tcx > ,
449
449
span : Span ,
450
450
) -> Self {
451
451
Self {
452
452
tcx,
453
- opaque_type_def_id ,
453
+ key ,
454
454
map,
455
455
map_missing_regions_to_empty : false ,
456
456
hidden_ty : Some ( hidden_ty) ,
@@ -504,7 +504,7 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
504
504
}
505
505
}
506
506
507
- let generics = self . tcx ( ) . generics_of ( self . opaque_type_def_id ) ;
507
+ let generics = self . tcx ( ) . generics_of ( self . key . def_id ) ;
508
508
match self . map . get ( & r. into ( ) ) . map ( |k| k. unpack ( ) ) {
509
509
Some ( GenericArgKind :: Lifetime ( r1) ) => r1,
510
510
Some ( u) => panic ! ( "region mapped to unexpected kind: {:?}" , u) ,
@@ -513,9 +513,10 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
513
513
if let Some ( hidden_ty) = self . hidden_ty . take ( ) {
514
514
unexpected_hidden_region_diagnostic (
515
515
self . tcx ,
516
- self . tcx . def_span ( self . opaque_type_def_id ) ,
516
+ self . tcx . def_span ( self . key . def_id ) ,
517
517
hidden_ty,
518
518
r,
519
+ self . key ,
519
520
)
520
521
. emit ( ) ;
521
522
}
0 commit comments