Skip to content

Commit 88f1088

Browse files
committed
rename GCA features
1 parent 7618355 commit 88f1088

417 files changed

Lines changed: 734 additions & 669 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎compiler/rustc_ast/src/ast.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ pub struct BorrowedFnSig<'a> {
24022402
/// * the `G<Ty> = Ty` in `Trait<G<Ty> = Ty>`
24032403
/// * the `A: Bound` in `Trait<A: Bound>`
24042404
/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
2405-
/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `min_generic_const_args`)
2405+
/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `gca_min_const_items`)
24062406
/// * the `f(..): Bound` in `Trait<f(..): Bound>` (feature `return_type_notation`)
24072407
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
24082408
pub struct AssocItemConstraint {

‎compiler/rustc_ast_lowering/src/lib.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14031403
// type and value namespaces. If we resolved the path in the value namespace, we
14041404
// transform it into a generic const argument.
14051405
//
1406-
// Note that even under `#![feature(min_generic_const_args)]`, only plain paths
1406+
// Note that even under `#![feature(gca_min_const_items)]`, only plain paths
14071407
// to constants are allowed - e.g. `A::<T::ASSOC_CONST>` and
14081408
// `A::<CONST_WITH_PARAM::<2>>` are disallowed (they must be wrapped in `{ }`).
14091409
//
@@ -1420,7 +1420,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14201420
let ct = self.arena.alloc(ct);
14211421
return GenericArg::Const(ct.try_as_ambig_ct().unwrap());
14221422
}
1423-
TyKind::GcaMacro(expr) if self.tcx.features().min_generic_const_args() => {
1423+
TyKind::GcaMacro(expr) if self.tcx.features().gca_min_const_items() => {
14241424
let ct = match self.can_lower_expr_to_const_arg_direct(
14251425
expr,
14261426
DirectConstArgContext::MacrolessMinGenericConstArgs,
@@ -2558,7 +2558,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
25582558
// We cannot just match on `ExprKind::Underscore` as `(_)` is represented as
25592559
// `ExprKind::Paren(ExprKind::Underscore)` and should also be lowered to `GenericArg::Infer`
25602560
//
2561-
// FIXME(macroless_generic_const_args): Handling of underscores should be moved into
2561+
// FIXME(gca_macroless_args): Handling of underscores should be moved into
25622562
// lower_expr_to_const_arg_direct. It is left here as retaining compatibility of what is
25632563
// currently allowed on stable gets hairy and annoying otherwise.
25642564
match c.value.peel_parens().kind {
@@ -2632,7 +2632,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
26322632
span: Span,
26332633
) -> hir::ConstItemRhs<'hir> {
26342634
let is_direct = |body| {
2635-
if self.tcx.features().macroless_const_item_generic_const_args() {
2635+
if self.tcx.features().gca_macroless_items() {
26362636
self.can_lower_expr_to_const_arg_direct(
26372637
body,
26382638
DirectConstArgContext::MacrolessMinGenericConstArgs,
@@ -2645,7 +2645,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
26452645
matches!(body, Expr { kind: ExprKind::GcaMacro(_), .. })
26462646
}
26472647
};
2648-
if self.tcx.features().min_generic_const_args()
2648+
if self.tcx.features().gca_min_const_items()
26492649
&& let Some(body) = body
26502650
&& is_direct(body)
26512651
{
@@ -2658,9 +2658,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
26582658
}
26592659

26602660
fn ambient_direct_const_arg_context(&self) -> DirectConstArgContext {
2661-
if self.tcx.features().macroless_generic_const_args() {
2661+
if self.tcx.features().gca_macroless_args() {
26622662
DirectConstArgContext::MacrolessMinGenericConstArgs
2663-
} else if self.tcx.features().min_generic_const_args() {
2663+
} else if self.tcx.features().gca_min_const_items() {
26642664
DirectConstArgContext::MinGenericConstArgs
26652665
} else {
26662666
DirectConstArgContext::Stable
@@ -2965,7 +2965,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
29652965
fn lower_anon_const_to_const_arg(&mut self, anon: &AnonConst) -> hir::ConstArg<'hir> {
29662966
// Stable only allows one nesting of blocks for directly represented paths. mGCA allows
29672967
// arbitrarily many, and are handled inside lower_expr_to_const_arg_direct for consistency.
2968-
let expr = if self.tcx.features().macroless_generic_const_args() {
2968+
let expr = if self.tcx.features().gca_macroless_args() {
29692969
&anon.value
29702970
} else {
29712971
anon.value.maybe_unwrap_block()

‎compiler/rustc_ast_passes/src/feature_gate.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,12 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
442442
gate_all!(final_associated_functions, "`final` on trait functions is experimental");
443443
gate_all!(fn_delegation, "functions delegation is not yet fully implemented");
444444
gate_all!(frontmatter, "frontmatters are experimental");
445+
gate_all!(gca_min_const_items, "unbraced const blocks as const args are experimental");
445446
gate_all!(gen_blocks, "gen blocks are experimental");
446447
gate_all!(generic_const_items, "generic const items are experimental");
447448
gate_all!(global_registration, "global registration is experimental");
448449
gate_all!(guard_patterns, "guard patterns are experimental", "consider using match arm guards");
449450
gate_all!(impl_restriction, "`impl` restrictions are experimental");
450-
gate_all!(min_generic_const_args, "unbraced const blocks as const args are experimental");
451451
gate_all!(more_qualified_paths, "usage of qualified paths in this context is experimental");
452452
gate_all!(move_expr, "`move(expr)` syntax is experimental");
453453
gate_all!(mut_ref, "mutable by-reference bindings are experimental");
@@ -490,9 +490,9 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
490490
"named parameters in parenthesized generic argument lists are experimental"
491491
);
492492

493-
// `associated_const_equality` will be stabilized as part of `min_generic_const_args`.
493+
// `associated_const_equality` will be stabilized as part of `gca_min_const_items`.
494494
for &span in spans.get(&sym::associated_const_equality).into_flat_iter() {
495-
gate!(visitor, min_generic_const_args, span, "associated const equality is incomplete");
495+
gate!(visitor, gca_min_const_items, span, "associated const equality is incomplete");
496496
}
497497

498498
// Negative bounds are *super* internal. We require `-Zinternal-testing-features` *and*
@@ -703,13 +703,13 @@ fn check_features_requiring_new_solver(sess: &Session, features: &Features) {
703703
if let Some(gca_span) = features
704704
.enabled_lang_features()
705705
.iter()
706-
.find(|feat| feat.gate_name == sym::generic_const_args)
706+
.find(|feat| feat.gate_name == sym::gca_const_items)
707707
.map(|feat| feat.attr_sp)
708708
{
709709
#[allow(rustc::symbol_intern_string_literal)]
710710
sess.dcx().emit_err(diagnostics::MissingDependentFeatures {
711711
parent_span: gca_span,
712-
parent: sym::generic_const_args,
712+
parent: sym::gca_const_items,
713713
missing: String::from("-Znext-solver=globally"),
714714
});
715715
}

‎compiler/rustc_attr_parsing/src/attributes/semantics.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ impl NoArgsAttributeParser for AlwaysGcaParser {
2828
const PATH: &[Symbol] = &[sym::rustc_always_gca];
2929
const ALLOWED_TARGETS: AllowedTargets<'_> =
3030
AllowedTargets::AllowList(&[Allow(Target::AssocConst(AssocCtxt::Trait))]);
31-
const STABILITY: AttributeStability = unstable!(min_generic_const_args);
31+
const STABILITY: AttributeStability = unstable!(gca_min_const_items);
3232
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::AlwaysGca;
3333
}

‎compiler/rustc_feature/src/removed.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ declare_features! (
6363
(removed, allow_fail, "1.60.0", Some(46488), Some("removed due to no clear use cases"), 93416),
6464
/// Allows users to enforce equality of associated constants `TraitImpl<AssocConst=3>`.
6565
(removed, associated_const_equality, "1.94.0", Some(92827),
66-
Some("merged into `min_generic_const_args`")),
66+
Some("merged into `gca_min_const_items`")),
6767
(removed, await_macro, "1.38.0", Some(50547),
6868
Some("subsumed by `.await` syntax"), 62293),
6969
/// Allows using `box` in patterns (RFC 469).
@@ -167,6 +167,7 @@ declare_features! (
167167
),
168168
133768
169169
),
170+
(removed, generic_const_args, "CURRENT_RUSTC_VERSION", Some(151972), Some("renamed to `gca_const_items`")),
170171
(removed, import_shadowing, "1.0.0", None, None),
171172
/// Allows in-band quantification of lifetime bindings (e.g., `fn foo(x: &'a u8) -> &'a u8`).
172173
(removed, in_band_lifetimes, "1.61.0", Some(44524),
@@ -192,9 +193,12 @@ declare_features! (
192193
which is available from cargo build scripts with `cargo:rustc-link-arg` now"), 83820),
193194
(removed, macro_reexport, "1.0.0", Some(29638),
194195
Some("subsumed by `pub use`"), 49982),
196+
(removed, macroless_const_item_generic_const_args, "CURRENT_RUSTC_VERSION", Some(162540), Some("renamed to `gca_macroless_items`")),
197+
(removed, macroless_generic_const_args, "CURRENT_RUSTC_VERSION", Some(159006), Some("renamed to `gca_macroless_args`")),
195198
/// Allows using `#[main]` to replace the entrypoint `#[lang = "start"]` calls.
196199
(removed, main, "1.53.0", Some(29634), None, 84217),
197200
(removed, managed_boxes, "1.0.0", None, None),
201+
(removed, min_generic_const_args, "CURRENT_RUSTC_VERSION", Some(132980), Some("renamed to `gca_min_const_items`")),
198202
/// Allows the use of type alias impl trait in function return positions
199203
(removed, min_type_alias_impl_trait, "1.56.0", Some(63063),
200204
Some("removed in favor of full type_alias_impl_trait"), 87564),

‎compiler/rustc_feature/src/unstable.rs‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,18 @@ declare_features! (
546546
(internal, freeze_impls, "1.78.0", Some(121675)),
547547
/// Frontmatter `---` blocks for use by external tools.
548548
(unstable, frontmatter, "1.88.0", Some(136889)),
549+
/// Allows using generics in more complex const expressions, based on definitional equality.
550+
(incomplete, gca_const_items, "1.95.0", Some(151972)),
551+
/// Allows directly represented gca_const_items without the `gca!` macro.
552+
(incomplete, gca_macroless_args, "1.99.0", Some(159006)),
553+
/// Allows directly represented gca_const_items as the rhs of const items without the
554+
/// `gca!` macro.
555+
(incomplete, gca_macroless_items, "CURRENT_RUSTC_VERSION", Some(162540)),
556+
/// Enables the generic const args MVP (paths to type const items and constructors
557+
/// for ADTs and primitives).
558+
(incomplete, gca_min_const_items, "1.84.0", Some(132980)),
549559
/// Allows defining gen blocks and `gen fn`.
550560
(unstable, gen_blocks, "1.75.0", Some(117078)),
551-
/// Allows using generics in more complex const expressions, based on definitional equality.
552-
(incomplete, generic_const_args, "1.95.0", Some(151972)),
553561
/// Allows non-trivial generic constants which have to be shown to successfully evaluate
554562
/// to a value by being part of an item signature.
555563
(incomplete, generic_const_exprs, "1.56.0", Some(76560)),
@@ -609,19 +617,11 @@ declare_features! (
609617
(unstable, macro_metavar_expr, "1.61.0", Some(83527)),
610618
/// Provides a way to concatenate identifiers using metavariable expressions.
611619
(unstable, macro_metavar_expr_concat, "1.81.0", Some(124225)),
612-
/// Allows directly represented generic_const_args as the rhs of const items without the
613-
/// `gca!` macro.
614-
(incomplete, macroless_const_item_generic_const_args, "CURRENT_RUSTC_VERSION", Some(162540)),
615-
/// Allows directly represented generic_const_args without the `gca!` macro.
616-
(incomplete, macroless_generic_const_args, "1.99.0", Some(159006)),
617620
/// Allows `#[marker]` on certain traits allowing overlapping implementations.
618621
(unstable, marker_trait_attr, "1.30.0", Some(29864)),
619622
/// Allows additional const parameter types, such as [u8; 10] or user defined types.
620623
/// User defined types must not have fields more private than the type itself.
621624
(unstable, min_adt_const_params, "1.96.0", Some(154042)),
622-
/// Enables the generic const args MVP (paths to type const items and constructors
623-
/// for ADTs and primitives).
624-
(incomplete, min_generic_const_args, "1.84.0", Some(132980)),
625625
/// A minimal, sound subset of specialization intended to be used by the
626626
/// standard library until the soundness issues with specialization
627627
/// are fixed.
@@ -859,8 +859,8 @@ pub const INCOMPATIBLE_FEATURES: &[(Symbol, Symbol)] = &[
859859

860860
/// Some features require one or more other features to be enabled.
861861
pub const DEPENDENT_FEATURES: &[(Symbol, &[Symbol])] = &[
862-
(sym::generic_const_args, &[sym::min_generic_const_args]),
863-
(sym::macroless_generic_const_args, &[sym::min_generic_const_args]),
864-
(sym::macroless_const_item_generic_const_args, &[sym::min_generic_const_args]),
862+
(sym::gca_const_items, &[sym::gca_min_const_items]),
863+
(sym::gca_macroless_args, &[sym::gca_min_const_items]),
864+
(sym::gca_macroless_items, &[sym::gca_min_const_items]),
865865
(sym::unsized_const_params, &[sym::adt_const_params]),
866866
];

‎compiler/rustc_hir/src/hir.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3093,7 +3093,7 @@ pub enum ImplItemKind<'hir> {
30933093
/// * the `G<Ty> = Ty` in `Trait<G<Ty> = Ty>`
30943094
/// * the `A: Bound` in `Trait<A: Bound>`
30953095
/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
3096-
/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `min_generic_const_args`)
3096+
/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `gca_min_const_items`)
30973097
/// * the `f(..): Bound` in `Trait<f(..): Bound>` (feature `return_type_notation`)
30983098
#[derive(Debug, Clone, Copy, StableHash)]
30993099
pub struct AssocItemConstraint<'hir> {

‎compiler/rustc_hir_analysis/src/check/compare_impl_item.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,8 +2162,8 @@ pub(super) fn compare_const_directness<'tcx>(
21622162
if trait_is_gca == impl_is_gca {
21632163
return Ok(());
21642164
}
2165-
// feature(generic_const_args) is allowed to impl non-GCA traits with a GCA const
2166-
if tcx.features().generic_const_args() && !trait_is_gca && impl_is_gca {
2165+
// feature(gca_const_items) is allowed to impl non-GCA traits with a GCA const
2166+
if tcx.features().gca_const_items() && !trait_is_gca && impl_is_gca {
21672167
return Ok(());
21682168
}
21692169

‎compiler/rustc_hir_analysis/src/check/wfcheck.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ pub(super) fn check_const_item<'tcx>(
12891289
tcx.require_lang_item(LangItem::ConstParamTy, span),
12901290
);
12911291
}
1292-
// FIXME(min_generic_const_args): We *might* want to move this check to `type_of`, so we can
1292+
// FIXME(gca_min_const_items): We *might* want to move this check to `type_of`, so we can
12931293
// return `ty::Error` if it references invalid params. However, doing so is hard, because
12941294
// `type_of` doesn't know if it's a direct const - `const_of_item` determines that, and
12951295
// `const_of_item` calls `type_of`.

‎compiler/rustc_hir_analysis/src/collect.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ fn anon_const_kind<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> ty::AnonConstKin
18031803
debug_assert_matches!(const_arg.kind, hir::ConstArgKind::Anon(hir::AnonConst { def_id, .. }) if *def_id == def);
18041804
if tcx.features().generic_const_exprs() {
18051805
ty::AnonConstKind::GCE
1806-
} else if tcx.features().min_generic_const_args() {
1806+
} else if tcx.features().gca_min_const_items() {
18071807
ty::AnonConstKind::MCG
18081808
} else if let hir::Node::Expr(hir::Expr {
18091809
kind: hir::ExprKind::Repeat(_, repeat_count),

0 commit comments

Comments
 (0)