@@ -630,15 +630,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
630630 ( args, arg_count)
631631 }
632632
633- #[ instrument( level = "debug" , skip_all ) ]
633+ #[ instrument( level = "debug" , skip ( self ) ) ]
634634 pub fn lower_generic_args_of_assoc_item (
635635 & self ,
636636 span : Span ,
637637 item_def_id : DefId ,
638638 item_segment : & hir:: PathSegment < ' tcx > ,
639639 parent_args : GenericArgsRef < ' tcx > ,
640640 ) -> GenericArgsRef < ' tcx > {
641- debug ! ( ?span, ?item_def_id, ?item_segment) ;
642641 let ( args, _) =
643642 self . lower_generic_args_of_path ( span, item_def_id, parent_args, item_segment, None ) ;
644643 if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
@@ -2271,7 +2270,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
22712270 }
22722271 }
22732272
2274- #[ instrument( level = "debug" , skip( self ) ) ]
2273+ #[ instrument( level = "debug" , skip( self ) , ret ) ]
22752274 pub fn lower_const_assoc_path (
22762275 & self ,
22772276 hir_ref_id : HirId ,
@@ -2320,7 +2319,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
23202319 . collect :: < Vec < _ > > ( ) ;
23212320 match & candidates[ ..] {
23222321 [ ] => { }
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+ }
23242329 [ ..] => {
23252330 return Const :: new_error_with_message ( tcx, span, "ambiguous assoc const path" ) ;
23262331 }
@@ -2379,19 +2384,19 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
23792384 let assoc_const = self
23802385 . probe_assoc_item ( assoc_ident, ty:: AssocKind :: Const , hir_ref_id, span, trait_did)
23812386 . 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)
23832390 }
23842391
23852392 fn lower_assoc_const (
23862393 & self ,
23872394 span : Span ,
23882395 item_def_id : DefId ,
23892396 item_segment : & hir:: PathSegment < ' tcx > ,
2397+ parent_args : GenericArgsRef < ' tcx > ,
23902398 ) -> Const < ' tcx > {
23912399 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) ) ;
23952400 let args =
23962401 self . lower_generic_args_of_assoc_item ( span, item_def_id, item_segment, parent_args) ;
23972402 let uv = ty:: UnevaluatedConst :: new ( item_def_id, args) ;
0 commit comments