Skip to content

Commit 82c716e

Browse files
committed
Change gate logic for mgca_type_const_syntax to work also if min_generic_const_args is enabled.
1 parent 527d8f9 commit 82c716e

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
532532
gate_all!(fn_delegation, "functions delegation is not yet fully implemented");
533533
gate_all!(postfix_match, "postfix match is experimental");
534534
gate_all!(mut_ref, "mutable by-reference bindings are experimental");
535-
gate_all!(mgca_type_const_syntax, "`type const` syntax is experimental");
536535
gate_all!(min_generic_const_args, "unbraced const blocks as const args are experimental");
537536
// associated_const_equality is stabilized as part of min_generic_const_args
538537
if let Some(spans) = spans.get(&sym::associated_const_equality) {
@@ -550,6 +549,27 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
550549
}
551550
}
552551
}
552+
// `mgca_type_const_syntax` is part of `min_generic_const_args` so either
553+
// or both are enabled we don't need to emit a feature error.
554+
if let Some(spans) = spans.get(&sym::mgca_type_const_syntax) {
555+
for span in spans {
556+
if visitor.features.min_generic_const_args()
557+
|| visitor.features.mgca_type_const_syntax()
558+
|| span.allows_unstable(sym::min_generic_const_args)
559+
|| span.allows_unstable(sym::mgca_type_const_syntax)
560+
{
561+
continue;
562+
}
563+
feature_err(
564+
&visitor.sess,
565+
sym::mgca_type_const_syntax,
566+
*span,
567+
"`type const` syntax is experimental",
568+
)
569+
.emit();
570+
}
571+
}
572+
553573
gate_all!(global_registration, "global registration is experimental");
554574
gate_all!(return_type_notation, "return type notation is experimental");
555575
gate_all!(pin_ergonomics, "pinned reference syntax is experimental");

0 commit comments

Comments
 (0)