@@ -1489,9 +1489,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14891489 let ct = self . arena . alloc ( ct) ;
14901490 return GenericArg :: Const ( ct. try_as_ambig_ct ( ) . unwrap ( ) ) ;
14911491 }
1492- TyKind :: DirectConstArg ( expr)
1493- if self . tcx . features ( ) . min_generic_const_args ( ) =>
1494- {
1492+ TyKind :: GcaMacro ( expr) if self . tcx . features ( ) . min_generic_const_args ( ) => {
14951493 let ct = match self . can_lower_expr_to_const_arg_direct (
14961494 expr,
14971495 DirectConstArgContext :: MacrolessMinGenericConstArgs ,
@@ -1797,8 +1795,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
17971795 let fields = self . arena . alloc_slice ( fields) ;
17981796 hir:: TyKind :: View ( ty, fields)
17991797 }
1800- TyKind :: DirectConstArg ( expr) => {
1801- let e = self . emit_bad_direct_const_arg ( t. span , expr, "type" ) ;
1798+ TyKind :: GcaMacro ( expr) => {
1799+ let e = self . emit_bad_gca_macro ( t. span , expr, "type" ) ;
18021800 hir:: TyKind :: Err ( e)
18031801 }
18041802 TyKind :: Dummy => panic ! ( "`TyKind::Dummy` should never be lowered" ) ,
@@ -1807,16 +1805,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
18071805 hir:: Ty { kind, span : self . lower_span ( t. span ) , hir_id : self . lower_node_id ( t. id ) }
18081806 }
18091807
1810- pub ( crate ) fn emit_bad_direct_const_arg (
1808+ pub ( crate ) fn emit_bad_gca_macro (
18111809 & mut self ,
18121810 span : Span ,
18131811 expr : & Expr ,
18141812 expected : & ' static str ,
18151813 ) -> ErrorGuaranteed {
1816- let msg = format ! ( "expected {expected}, found `direct_const_arg !()` constant" ) ;
1814+ let msg = format ! ( "expected {expected}, found `gca !()` constant" ) ;
18171815 if expr:: WillCreateDefIdsVisitor . visit_expr ( expr) . is_break ( ) {
18181816 // FIXME(mgca): make this non-fatal once we have a better way to handle
1819- // nested items in invalid `direct_const_arg !()` arguments.
1817+ // nested items in invalid `gca !()` arguments.
18201818 self . dcx ( ) . span_fatal ( span, msg)
18211819 } else {
18221820 self . dcx ( ) . span_err ( span, msg)
@@ -2711,9 +2709,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
27112709 . is_ok ( )
27122710 } else {
27132711 // do not check can_lower_expr_to_const_arg_direct, but rather just
2714- // ExprKind::DirectConstArg , because we don't want e.g.
2712+ // ExprKind::GcaMacro , because we don't want e.g.
27152713 // `impl<const N: u8> { const C: u8 = N; }` to be a direct-rhs const
2716- matches ! ( body, Expr { kind: ExprKind :: DirectConstArg ( _) , .. } )
2714+ matches ! ( body, Expr { kind: ExprKind :: GcaMacro ( _) , .. } )
27172715 }
27182716 } ;
27192717 if self . tcx . features ( ) . min_generic_const_args ( )
@@ -2816,7 +2814,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
28162814 Ok ( ( ) )
28172815 }
28182816 ( ExprKind :: ConstBlock ( _) , MacrolessMinGenericConstArgs ) => Ok ( ( ) ) ,
2819- ( ExprKind :: DirectConstArg ( _) , MacrolessMinGenericConstArgs | MinGenericConstArgs ) => {
2817+ ( ExprKind :: GcaMacro ( _) , MacrolessMinGenericConstArgs | MinGenericConstArgs ) => {
28202818 // Always report this as able to be represented directly. If it turns out not to be,
28212819 // `lower_expr_to_const_arg_direct` will report an error.
28222820 Ok ( ( ) )
@@ -2998,11 +2996,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
29982996 span,
29992997 }
30002998 }
3001- ExprKind :: DirectConstArg ( expr) => {
2999+ ExprKind :: GcaMacro ( expr) => {
30023000 // `can_lower_expr_to_const_arg_direct` always returns success upon encountering a
3003- // ExprKind::DirectConstArg, which effectively forces the expression to be lowered
3004- // as a direct arg. If it actually turns out to not be possible, emit an error
3005- // instead.
3001+ // ExprKind::GcaMacro, which effectively forces the expression to be lowered as a
3002+ // direct arg. If it actually turns out to not be possible, emit an error instead.
30063003 // Always use MacrolessMinGenericConstArgs, even if we're under regular GCA, because
30073004 // that's what the macro means: to enter a context that is like macroless GCA.
30083005 match self . can_lower_expr_to_const_arg_direct (
@@ -3354,12 +3351,12 @@ enum DirectConstArgContext {
33543351 /// The only allowed direct const arg representation is simple paths that nameres to generic
33553352 /// const parameters.
33563353 Stable ,
3357- /// The allowed representations are what is allowed on stable, plus the `direct_const_arg !` macro.
3354+ /// The allowed representations are what is allowed on stable, plus the `gca !` macro.
33583355 MinGenericConstArgs ,
33593356 /// Expressions attempt to be lowered directly, and if that fails, the expression falls back to
33603357 /// being represented as an anon const.
33613358 ///
3362- /// This context is also used under MinGenericConstArgs inside a `direct_const_arg !` macro, for
3359+ /// This context is also used under MinGenericConstArgs inside a `gca !` macro, for
33633360 /// simplicity, as they allow the same code.
33643361 MacrolessMinGenericConstArgs ,
33653362}
0 commit comments