@@ -1126,7 +1126,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11261126 AssocItemConstraintKind :: Equality { term } => {
11271127 let term = match term {
11281128 Term :: Ty ( ty) => self . lower_ty_alloc ( ty, itctx) . into ( ) ,
1129- Term :: Const ( c) => self . lower_anon_const_to_const_arg ( c) . into ( ) ,
1129+ Term :: Const ( c) => self . lower_anon_const_to_const_arg_and_alloc ( c) . into ( ) ,
11301130 } ;
11311131 hir:: AssocItemConstraintKind :: Equality { term }
11321132 }
@@ -1252,9 +1252,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12521252 }
12531253 GenericArg :: Type ( self . lower_ty_alloc ( ty, itctx) . try_as_ambig_ty ( ) . unwrap ( ) )
12541254 }
1255- ast:: GenericArg :: Const ( ct) => {
1256- GenericArg :: Const ( self . lower_anon_const_to_const_arg ( ct) . try_as_ambig_ct ( ) . unwrap ( ) )
1257- }
1255+ ast:: GenericArg :: Const ( ct) => GenericArg :: Const (
1256+ self . lower_anon_const_to_const_arg_and_alloc ( ct) . try_as_ambig_ct ( ) . unwrap ( ) ,
1257+ ) ,
12581258 }
12591259 }
12601260
@@ -2066,7 +2066,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20662066 false
20672067 }
20682068 } )
2069- . map ( |def| self . lower_anon_const_to_const_arg ( def) ) ;
2069+ . map ( |def| self . lower_anon_const_to_const_arg_and_alloc ( def) ) ;
20702070
20712071 (
20722072 hir:: ParamName :: Plain ( self . lower_ident ( param. ident ) ) ,
@@ -2288,7 +2288,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22882288 let ct_kind = hir:: ConstArgKind :: Infer ( self . lower_span ( c. value . span ) , ( ) ) ;
22892289 self . arena . alloc ( hir:: ConstArg { hir_id : self . lower_node_id ( c. id ) , kind : ct_kind } )
22902290 }
2291- _ => self . lower_anon_const_to_const_arg ( c) ,
2291+ _ => self . lower_anon_const_to_const_arg_and_alloc ( c) ,
22922292 }
22932293 }
22942294
@@ -2367,7 +2367,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23672367 ) -> hir:: ConstItemRhs < ' hir > {
23682368 match rhs {
23692369 Some ( ConstItemRhs :: TypeConst ( anon) ) => {
2370- hir:: ConstItemRhs :: TypeConst ( self . lower_anon_const_to_const_arg ( anon) )
2370+ hir:: ConstItemRhs :: TypeConst ( self . lower_anon_const_to_const_arg_and_alloc ( anon) )
23712371 }
23722372 None if attr:: contains_name ( attrs, sym:: type_const) => {
23732373 let const_arg = ConstArg {
@@ -2414,7 +2414,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24142414 let def_id = self . local_def_id ( anon_const. id ) ;
24152415 let def_kind = self . tcx . def_kind ( def_id) ;
24162416 assert_eq ! ( DefKind :: AnonConst , def_kind) ;
2417- self . lower_anon_const_to_const_arg_direct ( anon_const)
2417+ self . lower_anon_const_to_const_arg ( anon_const)
24182418 } else {
24192419 self . lower_expr_to_const_arg_direct ( arg)
24202420 } ;
@@ -2467,7 +2467,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24672467 let def_kind = self . tcx . def_kind ( def_id) ;
24682468 assert_eq ! ( DefKind :: AnonConst , def_kind) ;
24692469
2470- self . lower_anon_const_to_const_arg_direct ( anon_const)
2470+ self . lower_anon_const_to_const_arg ( anon_const)
24712471 } else {
24722472 self . lower_expr_to_const_arg_direct ( & f. expr )
24732473 } ;
@@ -2508,12 +2508,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25082508
25092509 /// See [`hir::ConstArg`] for when to use this function vs
25102510 /// [`Self::lower_anon_const_to_anon_const`].
2511- fn lower_anon_const_to_const_arg ( & mut self , anon : & AnonConst ) -> & ' hir hir:: ConstArg < ' hir > {
2512- self . arena . alloc ( self . lower_anon_const_to_const_arg_direct ( anon) )
2511+ fn lower_anon_const_to_const_arg_and_alloc (
2512+ & mut self ,
2513+ anon : & AnonConst ,
2514+ ) -> & ' hir hir:: ConstArg < ' hir > {
2515+ self . arena . alloc ( self . lower_anon_const_to_const_arg ( anon) )
25132516 }
25142517
25152518 #[ instrument( level = "debug" , skip( self ) ) ]
2516- fn lower_anon_const_to_const_arg_direct ( & mut self , anon : & AnonConst ) -> hir:: ConstArg < ' hir > {
2519+ fn lower_anon_const_to_const_arg ( & mut self , anon : & AnonConst ) -> hir:: ConstArg < ' hir > {
25172520 let tcx = self . tcx ;
25182521
25192522 // We cannot change parsing depending on feature gates available,
0 commit comments