@@ -137,12 +137,13 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
137137 ty : Ty ,
138138 // We need the original resolution to lower `Self::AssocTy` correctly
139139 res : Option < TypeNs > ,
140+ infer_args : bool ,
140141 ) -> ( Ty , Option < TypeNs > ) {
141142 match self . segments . len ( ) - self . current_segment_idx {
142143 0 => ( ty, res) ,
143144 1 => {
144145 // resolve unselected assoc types
145- ( self . select_associated_type ( res) , None )
146+ ( self . select_associated_type ( res, infer_args ) , None )
146147 }
147148 _ => {
148149 // FIXME report error (ambiguous associated type)
@@ -166,6 +167,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
166167 let trait_ref = self . lower_trait_ref_from_resolved_path (
167168 trait_,
168169 TyKind :: Error . intern ( Interner ) ,
170+ infer_args,
169171 ) ;
170172
171173 self . skip_resolved_segment ( ) ;
@@ -181,7 +183,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
181183 // this point (`trait_ref.substitution`).
182184 let substitution = self . substs_from_path_segment (
183185 associated_ty. into ( ) ,
184- false ,
186+ infer_args ,
185187 None ,
186188 true ,
187189 ) ;
@@ -276,7 +278,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
276278 } ;
277279
278280 self . skip_resolved_segment ( ) ;
279- self . lower_ty_relative_path ( ty, Some ( resolution) )
281+ self . lower_ty_relative_path ( ty, Some ( resolution) , infer_args )
280282 }
281283
282284 fn handle_type_ns_resolution ( & mut self , resolution : & TypeNs ) {
@@ -472,7 +474,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
472474 Some ( res)
473475 }
474476
475- fn select_associated_type ( & mut self , res : Option < TypeNs > ) -> Ty {
477+ fn select_associated_type ( & mut self , res : Option < TypeNs > , infer_args : bool ) -> Ty {
476478 let Some ( res) = res else {
477479 return TyKind :: Error . intern ( Interner ) ;
478480 } ;
@@ -506,7 +508,8 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
506508 // generic params. It's inefficient to splice the `Substitution`s, so we may want
507509 // that method to optionally take parent `Substitution` as we already know them at
508510 // this point (`t.substitution`).
509- let substs = self . substs_from_path_segment ( associated_ty. into ( ) , false , None , true ) ;
511+ let substs =
512+ self . substs_from_path_segment ( associated_ty. into ( ) , infer_args, None , true ) ;
510513
511514 let substs = Substitution :: from_iter (
512515 Interner ,
@@ -830,17 +833,19 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
830833 & mut self ,
831834 resolved : TraitId ,
832835 explicit_self_ty : Ty ,
836+ infer_args : bool ,
833837 ) -> TraitRef {
834- let substs = self . trait_ref_substs_from_path ( resolved, explicit_self_ty) ;
838+ let substs = self . trait_ref_substs_from_path ( resolved, explicit_self_ty, infer_args ) ;
835839 TraitRef { trait_id : to_chalk_trait_id ( resolved) , substitution : substs }
836840 }
837841
838842 fn trait_ref_substs_from_path (
839843 & mut self ,
840844 resolved : TraitId ,
841845 explicit_self_ty : Ty ,
846+ infer_args : bool ,
842847 ) -> Substitution {
843- self . substs_from_path_segment ( resolved. into ( ) , false , Some ( explicit_self_ty) , false )
848+ self . substs_from_path_segment ( resolved. into ( ) , infer_args , Some ( explicit_self_ty) , false )
844849 }
845850
846851 pub ( super ) fn assoc_type_bindings_from_type_bound < ' c > (
0 commit comments