@@ -621,15 +621,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
621
621
( args, arg_count)
622
622
}
623
623
624
- #[ instrument( level = "debug" , skip_all ) ]
624
+ #[ instrument( level = "debug" , skip ( self ) ) ]
625
625
pub fn lower_generic_args_of_assoc_item (
626
626
& self ,
627
627
span : Span ,
628
628
item_def_id : DefId ,
629
629
item_segment : & hir:: PathSegment < ' tcx > ,
630
630
parent_args : GenericArgsRef < ' tcx > ,
631
631
) -> GenericArgsRef < ' tcx > {
632
- debug ! ( ?span, ?item_def_id, ?item_segment) ;
633
632
let ( args, _) =
634
633
self . lower_generic_args_of_path ( span, item_def_id, parent_args, item_segment, None ) ;
635
634
if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
@@ -2210,7 +2209,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2210
2209
}
2211
2210
}
2212
2211
2213
- #[ instrument( level = "debug" , skip( self ) ) ]
2212
+ #[ instrument( level = "debug" , skip( self ) , ret ) ]
2214
2213
pub fn lower_const_assoc_path (
2215
2214
& self ,
2216
2215
hir_ref_id : HirId ,
@@ -2259,7 +2258,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2259
2258
. collect :: < Vec < _ > > ( ) ;
2260
2259
match & candidates[ ..] {
2261
2260
[ ] => { }
2262
- [ assoc] => return self . lower_assoc_const ( span, assoc. def_id , assoc_segment) ,
2261
+ [ assoc] => {
2262
+ // FIXME: this is not necessarily correct.
2263
+ // adapted from other code that also had a fixme about it being temporary.
2264
+ let parent_args =
2265
+ ty:: GenericArgs :: identity_for_item ( tcx, tcx. parent ( assoc. def_id ) ) ;
2266
+ return self . lower_assoc_const ( span, assoc. def_id , assoc_segment, parent_args) ;
2267
+ }
2263
2268
[ ..] => {
2264
2269
return Const :: new_error_with_message ( tcx, span, "ambiguous assoc const path" ) ;
2265
2270
}
@@ -2318,19 +2323,19 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2318
2323
let assoc_const = self
2319
2324
. probe_assoc_item ( assoc_ident, ty:: AssocKind :: Const , hir_ref_id, span, trait_did)
2320
2325
. expect ( "failed to find associated const" ) ;
2321
- self . lower_assoc_const ( span, assoc_const. def_id , assoc_segment)
2326
+ // TODO: don't use no_bound_vars probably
2327
+ let trait_ref_args = bound. no_bound_vars ( ) . unwrap ( ) . args ;
2328
+ self . lower_assoc_const ( span, assoc_const. def_id , assoc_segment, trait_ref_args)
2322
2329
}
2323
2330
2324
2331
fn lower_assoc_const (
2325
2332
& self ,
2326
2333
span : Span ,
2327
2334
item_def_id : DefId ,
2328
2335
item_segment : & hir:: PathSegment < ' tcx > ,
2336
+ parent_args : GenericArgsRef < ' tcx > ,
2329
2337
) -> Const < ' tcx > {
2330
2338
let tcx = self . tcx ( ) ;
2331
- // FIXME: this is not necessarily correct.
2332
- // adapted from other code that also had a fixme about it being temporary.
2333
- let parent_args = ty:: GenericArgs :: identity_for_item ( tcx, tcx. parent ( item_def_id) ) ;
2334
2339
let args =
2335
2340
self . lower_generic_args_of_assoc_item ( span, item_def_id, item_segment, parent_args) ;
2336
2341
let uv = ty:: UnevaluatedConst :: new ( item_def_id, args) ;
0 commit comments