@@ -246,7 +246,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
246246 // after producing an error for each of them.
247247 let definition_ty = instantiated_ty. ty . fold_with ( & mut ReverseMapper :: new (
248248 self . tcx ,
249- def_id ,
249+ opaque_type_key ,
250250 map,
251251 instantiated_ty. ty ,
252252 instantiated_ty. span ,
@@ -429,7 +429,7 @@ fn check_opaque_type_parameter_valid(
429429struct ReverseMapper < ' tcx > {
430430 tcx : TyCtxt < ' tcx > ,
431431
432- opaque_type_def_id : LocalDefId ,
432+ key : ty :: OpaqueTypeKey < ' tcx > ,
433433 map : FxHashMap < GenericArg < ' tcx > , GenericArg < ' tcx > > ,
434434 map_missing_regions_to_empty : bool ,
435435
@@ -443,14 +443,14 @@ struct ReverseMapper<'tcx> {
443443impl < ' tcx > ReverseMapper < ' tcx > {
444444 fn new (
445445 tcx : TyCtxt < ' tcx > ,
446- opaque_type_def_id : LocalDefId ,
446+ key : ty :: OpaqueTypeKey < ' tcx > ,
447447 map : FxHashMap < GenericArg < ' tcx > , GenericArg < ' tcx > > ,
448448 hidden_ty : Ty < ' tcx > ,
449449 span : Span ,
450450 ) -> Self {
451451 Self {
452452 tcx,
453- opaque_type_def_id ,
453+ key ,
454454 map,
455455 map_missing_regions_to_empty : false ,
456456 hidden_ty : Some ( hidden_ty) ,
@@ -504,7 +504,7 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
504504 }
505505 }
506506
507- let generics = self . tcx ( ) . generics_of ( self . opaque_type_def_id ) ;
507+ let generics = self . tcx ( ) . generics_of ( self . key . def_id ) ;
508508 match self . map . get ( & r. into ( ) ) . map ( |k| k. unpack ( ) ) {
509509 Some ( GenericArgKind :: Lifetime ( r1) ) => r1,
510510 Some ( u) => panic ! ( "region mapped to unexpected kind: {:?}" , u) ,
@@ -513,9 +513,10 @@ impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
513513 if let Some ( hidden_ty) = self . hidden_ty . take ( ) {
514514 unexpected_hidden_region_diagnostic (
515515 self . tcx ,
516- self . tcx . def_span ( self . opaque_type_def_id ) ,
516+ self . tcx . def_span ( self . key . def_id ) ,
517517 hidden_ty,
518518 r,
519+ self . key ,
519520 )
520521 . emit ( ) ;
521522 }
0 commit comments