@@ -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_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_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_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_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_alloc ( anon) )
23712371 }
23722372 None if attr:: contains_name ( attrs, sym:: type_const) => {
23732373 let const_arg = ConstArg {
@@ -2438,7 +2438,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24382438 let def_kind = self . tcx . def_kind ( def_id) ;
24392439 assert_eq ! ( DefKind :: AnonConst , def_kind) ;
24402440
2441- self . lower_anon_const_to_const_arg_direct ( anon_const)
2441+ self . lower_anon_const_to_const_arg ( anon_const)
24422442 } else {
24432443 self . lower_expr_to_const_arg_direct ( & f. expr )
24442444 } ;
@@ -2476,12 +2476,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24762476
24772477 /// See [`hir::ConstArg`] for when to use this function vs
24782478 /// [`Self::lower_anon_const_to_anon_const`].
2479- fn lower_anon_const_to_const_arg ( & mut self , anon : & AnonConst ) -> & ' hir hir:: ConstArg < ' hir > {
2480- self . arena . alloc ( self . lower_anon_const_to_const_arg_direct ( anon) )
2479+ fn lower_anon_const_to_const_arg_alloc (
2480+ & mut self ,
2481+ anon : & AnonConst ,
2482+ ) -> & ' hir hir:: ConstArg < ' hir > {
2483+ self . arena . alloc ( self . lower_anon_const_to_const_arg ( anon) )
24812484 }
24822485
24832486 #[ instrument( level = "debug" , skip( self ) ) ]
2484- fn lower_anon_const_to_const_arg_direct ( & mut self , anon : & AnonConst ) -> hir:: ConstArg < ' hir > {
2487+ fn lower_anon_const_to_const_arg ( & mut self , anon : & AnonConst ) -> hir:: ConstArg < ' hir > {
24852488 let tcx = self . tcx ;
24862489
24872490 // We cannot change parsing depending on feature gates available,
0 commit comments