@@ -1124,7 +1124,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11241124 AssocItemConstraintKind :: Equality { term } => {
11251125 let term = match term {
11261126 Term :: Ty ( ty) => self . lower_ty_and_alloc ( ty, itctx) . into ( ) ,
1127- Term :: Const ( c) => self . lower_anon_const_to_const_arg ( c) . into ( ) ,
1127+ Term :: Const ( c) => self . lower_anon_const_to_const_arg_and_alloc ( c) . into ( ) ,
11281128 } ;
11291129 hir:: AssocItemConstraintKind :: Equality { term }
11301130 }
@@ -1250,9 +1250,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12501250 }
12511251 GenericArg :: Type ( self . lower_ty_and_alloc ( ty, itctx) . try_as_ambig_ty ( ) . unwrap ( ) )
12521252 }
1253- ast:: GenericArg :: Const ( ct) => {
1254- GenericArg :: Const ( self . lower_anon_const_to_const_arg ( ct) . try_as_ambig_ct ( ) . unwrap ( ) )
1255- }
1253+ ast:: GenericArg :: Const ( ct) => GenericArg :: Const (
1254+ self . lower_anon_const_to_const_arg_and_alloc ( ct) . try_as_ambig_ct ( ) . unwrap ( ) ,
1255+ ) ,
12561256 }
12571257 }
12581258
@@ -2065,7 +2065,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20652065 false
20662066 }
20672067 } )
2068- . map ( |def| self . lower_anon_const_to_const_arg ( def) ) ;
2068+ . map ( |def| self . lower_anon_const_to_const_arg_and_alloc ( def) ) ;
20692069
20702070 (
20712071 hir:: ParamName :: Plain ( self . lower_ident ( param. ident ) ) ,
@@ -2287,7 +2287,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22872287 let ct_kind = hir:: ConstArgKind :: Infer ( self . lower_span ( c. value . span ) , ( ) ) ;
22882288 self . arena . alloc ( hir:: ConstArg { hir_id : self . lower_node_id ( c. id ) , kind : ct_kind } )
22892289 }
2290- _ => self . lower_anon_const_to_const_arg ( c) ,
2290+ _ => self . lower_anon_const_to_const_arg_and_alloc ( c) ,
22912291 }
22922292 }
22932293
@@ -2366,7 +2366,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23662366 ) -> hir:: ConstItemRhs < ' hir > {
23672367 match rhs {
23682368 Some ( ConstItemRhs :: TypeConst ( anon) ) => {
2369- hir:: ConstItemRhs :: TypeConst ( self . lower_anon_const_to_const_arg ( anon) )
2369+ hir:: ConstItemRhs :: TypeConst ( self . lower_anon_const_to_const_arg_and_alloc ( anon) )
23702370 }
23712371 None if attr:: contains_name ( attrs, sym:: type_const) => {
23722372 let const_arg = ConstArg {
@@ -2434,12 +2434,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24342434
24352435 /// See [`hir::ConstArg`] for when to use this function vs
24362436 /// [`Self::lower_anon_const_to_anon_const`].
2437- fn lower_anon_const_to_const_arg ( & mut self , anon : & AnonConst ) -> & ' hir hir:: ConstArg < ' hir > {
2438- self . arena . alloc ( self . lower_anon_const_to_const_arg_direct ( anon) )
2437+ fn lower_anon_const_to_const_arg_and_alloc (
2438+ & mut self ,
2439+ anon : & AnonConst ,
2440+ ) -> & ' hir hir:: ConstArg < ' hir > {
2441+ self . arena . alloc ( self . lower_anon_const_to_const_arg ( anon) )
24392442 }
24402443
24412444 #[ instrument( level = "debug" , skip( self ) ) ]
2442- fn lower_anon_const_to_const_arg_direct ( & mut self , anon : & AnonConst ) -> hir:: ConstArg < ' hir > {
2445+ fn lower_anon_const_to_const_arg ( & mut self , anon : & AnonConst ) -> hir:: ConstArg < ' hir > {
24432446 let tcx = self . tcx ;
24442447
24452448 // We cannot change parsing depending on feature gates available,
0 commit comments