@@ -620,15 +620,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
620620 ( args, arg_count)
621621 }
622622
623- #[ instrument( level = "debug" , skip_all ) ]
623+ #[ instrument( level = "debug" , skip ( self ) ) ]
624624 pub fn lower_generic_args_of_assoc_item (
625625 & self ,
626626 span : Span ,
627627 item_def_id : DefId ,
628628 item_segment : & hir:: PathSegment < ' tcx > ,
629629 parent_args : GenericArgsRef < ' tcx > ,
630630 ) -> GenericArgsRef < ' tcx > {
631- debug ! ( ?span, ?item_def_id, ?item_segment) ;
632631 let ( args, _) =
633632 self . lower_generic_args_of_path ( span, item_def_id, parent_args, item_segment, None ) ;
634633 if let Some ( c) = item_segment. args ( ) . constraints . first ( ) {
@@ -2209,7 +2208,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
22092208 }
22102209 }
22112210
2212- #[ instrument( level = "debug" , skip( self ) ) ]
2211+ #[ instrument( level = "debug" , skip( self ) , ret ) ]
22132212 pub fn lower_const_assoc_path (
22142213 & self ,
22152214 hir_ref_id : HirId ,
@@ -2258,7 +2257,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
22582257 . collect :: < Vec < _ > > ( ) ;
22592258 match & candidates[ ..] {
22602259 [ ] => { }
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+ }
22622267 [ ..] => {
22632268 return Const :: new_error_with_message ( tcx, span, "ambiguous assoc const path" ) ;
22642269 }
@@ -2317,19 +2322,19 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
23172322 let assoc_const = self
23182323 . probe_assoc_item ( assoc_ident, ty:: AssocKind :: Const , hir_ref_id, span, trait_did)
23192324 . 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)
23212328 }
23222329
23232330 fn lower_assoc_const (
23242331 & self ,
23252332 span : Span ,
23262333 item_def_id : DefId ,
23272334 item_segment : & hir:: PathSegment < ' tcx > ,
2335+ parent_args : GenericArgsRef < ' tcx > ,
23282336 ) -> Const < ' tcx > {
23292337 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) ) ;
23332338 let args =
23342339 self . lower_generic_args_of_assoc_item ( span, item_def_id, item_segment, parent_args) ;
23352340 let uv = ty:: UnevaluatedConst :: new ( item_def_id, args) ;
0 commit comments