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