@@ -32,7 +32,6 @@ pub enum GenerateMemberConstraints {
3232pub trait InferCtxtExt < ' tcx > {
3333 fn instantiate_opaque_types < T : TypeFoldable < ' tcx > > (
3434 & self ,
35- parent_def_id : LocalDefId ,
3635 body_id : hir:: HirId ,
3736 param_env : ty:: ParamEnv < ' tcx > ,
3837 value : T ,
@@ -94,25 +93,18 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
9493 /// - `value_span` -- the span where the value came from, used in error reporting
9594 fn instantiate_opaque_types < T : TypeFoldable < ' tcx > > (
9695 & self ,
97- parent_def_id : LocalDefId ,
9896 body_id : hir:: HirId ,
9997 param_env : ty:: ParamEnv < ' tcx > ,
10098 value : T ,
10199 value_span : Span ,
102100 ) -> InferOk < ' tcx , T > {
103101 debug ! (
104- "instantiate_opaque_types(value={:?}, parent_def_id={:?}, body_id={:?}, \
102+ "instantiate_opaque_types(value={:?}, body_id={:?}, \
105103 param_env={:?}, value_span={:?})",
106- value, parent_def_id , body_id, param_env, value_span,
104+ value, body_id, param_env, value_span,
107105 ) ;
108- let mut instantiator = Instantiator {
109- infcx : self ,
110- parent_def_id,
111- body_id,
112- param_env,
113- value_span,
114- obligations : vec ! [ ] ,
115- } ;
106+ let mut instantiator =
107+ Instantiator { infcx : self , body_id, param_env, value_span, obligations : vec ! [ ] } ;
116108 let value = instantiator. instantiate_opaque_types_in_map ( value) ;
117109 InferOk { value, obligations : instantiator. obligations }
118110 }
@@ -857,7 +849,6 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
857849
858850struct Instantiator < ' a , ' tcx > {
859851 infcx : & ' a InferCtxt < ' a , ' tcx > ,
860- parent_def_id : LocalDefId ,
861852 body_id : hir:: HirId ,
862853 param_env : ty:: ParamEnv < ' tcx > ,
863854 value_span : Span ,
@@ -910,7 +901,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
910901 // ```
911902 if let Some ( def_id) = def_id. as_local ( ) {
912903 let opaque_hir_id = tcx. hir ( ) . local_def_id_to_hir_id ( def_id) ;
913- let parent_def_id = self . parent_def_id ;
904+ let parent_def_id = self . infcx . defining_use_anchor ;
914905 let def_scope_default = || {
915906 let opaque_parent_hir_id = tcx. hir ( ) . get_parent_item ( opaque_hir_id) ;
916907 parent_def_id == tcx. hir ( ) . local_def_id ( opaque_parent_hir_id)
@@ -922,14 +913,14 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
922913 impl_trait_fn : Some ( parent) ,
923914 origin,
924915 ..
925- } ) => ( parent == self . parent_def_id . to_def_id ( ) , origin) ,
916+ } ) => ( parent == parent_def_id. to_def_id ( ) , origin) ,
926917 // Named `type Foo = impl Bar;`
927918 hir:: ItemKind :: OpaqueTy ( hir:: OpaqueTy {
928919 impl_trait_fn : None ,
929920 origin,
930921 ..
931922 } ) => (
932- may_define_opaque_type ( tcx, self . parent_def_id , opaque_hir_id) ,
923+ may_define_opaque_type ( tcx, parent_def_id, opaque_hir_id) ,
933924 origin,
934925 ) ,
935926 _ => ( def_scope_default ( ) , hir:: OpaqueTyOrigin :: TyAlias ) ,
0 commit comments