@@ -25,7 +25,7 @@ use rustc_middle::arena::ArenaAllocatable;
2525use rustc_middle:: ty:: fold:: TypeFoldable ;
2626use rustc_middle:: ty:: relate:: TypeRelation ;
2727use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind } ;
28- use rustc_middle:: ty:: { self , BoundVar , Const , OpaqueTypeKey , ToPredicate , Ty , TyCtxt } ;
28+ use rustc_middle:: ty:: { self , BoundVar , Const , ToPredicate , Ty , TyCtxt } ;
2929use rustc_span:: Span ;
3030use std:: fmt:: Debug ;
3131use std:: iter;
@@ -146,13 +146,13 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
146146 } )
147147 }
148148
149- fn take_opaque_types_for_query_response ( & self ) -> Vec < ( OpaqueTypeKey < ' tcx > , Ty < ' tcx > ) > {
149+ fn take_opaque_types_for_query_response ( & self ) -> Vec < ( Ty < ' tcx > , Ty < ' tcx > ) > {
150150 self . inner
151151 . borrow_mut ( )
152152 . opaque_type_storage
153153 . take_opaque_types ( )
154154 . into_iter ( )
155- . map ( |( k, v) | ( k , v. hidden_type . ty ) )
155+ . map ( |( k, v) | ( self . tcx . mk_opaque ( k . def_id , k . substs ) , v. hidden_type . ty ) )
156156 . collect ( )
157157 }
158158
@@ -497,11 +497,10 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
497497 let mut obligations = vec ! [ ] ;
498498
499499 // Carry all newly resolved opaque types to the caller's scope
500- for & ( key, ty) in & query_response. value . opaque_types {
501- let substs = substitute_value ( self . tcx , & result_subst, key. substs ) ;
502- let opaque = self . tcx . mk_opaque ( key. def_id , substs) ;
503- let ty = substitute_value ( self . tcx , & result_subst, ty) ;
504- obligations. extend ( self . handle_opaque_type ( opaque, ty, cause, param_env) ?. obligations ) ;
500+ for & ( a, b) in & query_response. value . opaque_types {
501+ let a = substitute_value ( self . tcx , & result_subst, a) ;
502+ let b = substitute_value ( self . tcx , & result_subst, b) ;
503+ obligations. extend ( self . handle_opaque_type ( a, b, cause, param_env) ?. obligations ) ;
505504 }
506505
507506 Ok ( InferOk { value : result_subst, obligations } )
0 commit comments