@@ -137,12 +137,13 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
137
137
ty : Ty ,
138
138
// We need the original resolution to lower `Self::AssocTy` correctly
139
139
res : Option < TypeNs > ,
140
+ infer_args : bool ,
140
141
) -> ( Ty , Option < TypeNs > ) {
141
142
match self . segments . len ( ) - self . current_segment_idx {
142
143
0 => ( ty, res) ,
143
144
1 => {
144
145
// resolve unselected assoc types
145
- ( self . select_associated_type ( res) , None )
146
+ ( self . select_associated_type ( res, infer_args ) , None )
146
147
}
147
148
_ => {
148
149
// FIXME report error (ambiguous associated type)
@@ -166,6 +167,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
166
167
let trait_ref = self . lower_trait_ref_from_resolved_path (
167
168
trait_,
168
169
TyKind :: Error . intern ( Interner ) ,
170
+ infer_args,
169
171
) ;
170
172
171
173
self . skip_resolved_segment ( ) ;
@@ -181,7 +183,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
181
183
// this point (`trait_ref.substitution`).
182
184
let substitution = self . substs_from_path_segment (
183
185
associated_ty. into ( ) ,
184
- false ,
186
+ infer_args ,
185
187
None ,
186
188
true ,
187
189
) ;
@@ -276,7 +278,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
276
278
} ;
277
279
278
280
self . skip_resolved_segment ( ) ;
279
- self . lower_ty_relative_path ( ty, Some ( resolution) )
281
+ self . lower_ty_relative_path ( ty, Some ( resolution) , infer_args )
280
282
}
281
283
282
284
fn handle_type_ns_resolution ( & mut self , resolution : & TypeNs ) {
@@ -472,7 +474,7 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
472
474
Some ( res)
473
475
}
474
476
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 {
476
478
let Some ( res) = res else {
477
479
return TyKind :: Error . intern ( Interner ) ;
478
480
} ;
@@ -506,7 +508,8 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
506
508
// generic params. It's inefficient to splice the `Substitution`s, so we may want
507
509
// that method to optionally take parent `Substitution` as we already know them at
508
510
// 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 ) ;
510
513
511
514
let substs = Substitution :: from_iter (
512
515
Interner ,
@@ -830,17 +833,19 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
830
833
& mut self ,
831
834
resolved : TraitId ,
832
835
explicit_self_ty : Ty ,
836
+ infer_args : bool ,
833
837
) -> 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 ) ;
835
839
TraitRef { trait_id : to_chalk_trait_id ( resolved) , substitution : substs }
836
840
}
837
841
838
842
fn trait_ref_substs_from_path (
839
843
& mut self ,
840
844
resolved : TraitId ,
841
845
explicit_self_ty : Ty ,
846
+ infer_args : bool ,
842
847
) -> 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 )
844
849
}
845
850
846
851
pub ( super ) fn assoc_type_bindings_from_type_bound < ' c > (
0 commit comments