@@ -630,15 +630,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
630
630
( args, arg_count)
631
631
}
632
632
633
- #[ instrument( level = "debug" , skip_all ) ]
633
+ #[ instrument( level = "debug" , skip ( self ) ) ]
634
634
pub fn lower_generic_args_of_assoc_item (
635
635
& self ,
636
636
span : Span ,
637
637
item_def_id : DefId ,
638
638
item_segment : & hir:: PathSegment < ' tcx > ,
639
639
parent_args : GenericArgsRef < ' tcx > ,
640
640
) -> GenericArgsRef < ' tcx > {
641
- debug ! ( ?span, ?item_def_id, ?item_segment) ;
642
641
let ( args, _) =
643
642
self . lower_generic_args_of_path ( span, item_def_id, parent_args, item_segment, None ) ;
644
643
if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
@@ -2271,7 +2270,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2271
2270
}
2272
2271
}
2273
2272
2274
- #[ instrument( level = "debug" , skip( self ) ) ]
2273
+ #[ instrument( level = "debug" , skip( self ) , ret ) ]
2275
2274
pub fn lower_const_assoc_path (
2276
2275
& self ,
2277
2276
hir_ref_id : HirId ,
@@ -2320,7 +2319,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2320
2319
. collect :: < Vec < _ > > ( ) ;
2321
2320
match & candidates[ ..] {
2322
2321
[ ] => { }
2323
- [ assoc] => return self . lower_assoc_const ( span, assoc. def_id , assoc_segment) ,
2322
+ [ assoc] => {
2323
+ // FIXME: this is not necessarily correct.
2324
+ // adapted from other code that also had a fixme about it being temporary.
2325
+ let parent_args =
2326
+ ty:: GenericArgs :: identity_for_item ( tcx, tcx. parent ( assoc. def_id ) ) ;
2327
+ return self . lower_assoc_const ( span, assoc. def_id , assoc_segment, parent_args) ;
2328
+ }
2324
2329
[ ..] => {
2325
2330
return Const :: new_error_with_message ( tcx, span, "ambiguous assoc const path" ) ;
2326
2331
}
@@ -2379,19 +2384,19 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2379
2384
let assoc_const = self
2380
2385
. probe_assoc_item ( assoc_ident, ty:: AssocKind :: Const , hir_ref_id, span, trait_did)
2381
2386
. expect ( "failed to find associated const" ) ;
2382
- self . lower_assoc_const ( span, assoc_const. def_id , assoc_segment)
2387
+ // TODO: don't use no_bound_vars probably
2388
+ let trait_ref_args = bound. no_bound_vars ( ) . unwrap ( ) . args ;
2389
+ self . lower_assoc_const ( span, assoc_const. def_id , assoc_segment, trait_ref_args)
2383
2390
}
2384
2391
2385
2392
fn lower_assoc_const (
2386
2393
& self ,
2387
2394
span : Span ,
2388
2395
item_def_id : DefId ,
2389
2396
item_segment : & hir:: PathSegment < ' tcx > ,
2397
+ parent_args : GenericArgsRef < ' tcx > ,
2390
2398
) -> Const < ' tcx > {
2391
2399
let tcx = self . tcx ( ) ;
2392
- // FIXME: this is not necessarily correct.
2393
- // adapted from other code that also had a fixme about it being temporary.
2394
- let parent_args = ty:: GenericArgs :: identity_for_item ( tcx, tcx. parent ( item_def_id) ) ;
2395
2400
let args =
2396
2401
self . lower_generic_args_of_assoc_item ( span, item_def_id, item_segment, parent_args) ;
2397
2402
let uv = ty:: UnevaluatedConst :: new ( item_def_id, args) ;
0 commit comments