Skip to content

Commit fc61fab

Browse files
committed
Auto merge of #116116 - Nilstrieb:gate-all-__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, r=compiler-errors
Rename the legacy feature gating macro It had a really confusing name by shadowing the previous name, which has caused issues in the past where people added their new syntax in the legacy location. This makes it clear. Also adds a comment about the return type notation gating, which confused me why it was here at first before `@compiler-errors` told me why.
2 parents 26eeea6 + 845a027 commit fc61fab

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -578,25 +578,31 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
578578
}
579579
}
580580

581-
// All uses of `gate_all!` below this point were added in #65742,
581+
// All uses of `gate_all_legacy_dont_use!` below this point were added in #65742,
582582
// and subsequently disabled (with the non-early gating readded).
583583
// We emit an early future-incompatible warning for these.
584584
// New syntax gates should go above here to get a hard error gate.
585-
macro_rules! gate_all {
585+
macro_rules! gate_all_legacy_dont_use {
586586
($gate:ident, $msg:literal) => {
587587
for span in spans.get(&sym::$gate).unwrap_or(&vec![]) {
588588
gate_feature_post!(future_incompatible; &visitor, $gate, *span, $msg);
589589
}
590590
};
591591
}
592592

593-
gate_all!(trait_alias, "trait aliases are experimental");
594-
gate_all!(associated_type_bounds, "associated type bounds are unstable");
595-
gate_all!(return_type_notation, "return type notation is experimental");
596-
gate_all!(decl_macro, "`macro` is experimental");
597-
gate_all!(box_patterns, "box pattern syntax is experimental");
598-
gate_all!(exclusive_range_pattern, "exclusive range pattern syntax is experimental");
599-
gate_all!(try_blocks, "`try` blocks are unstable");
593+
gate_all_legacy_dont_use!(trait_alias, "trait aliases are experimental");
594+
gate_all_legacy_dont_use!(associated_type_bounds, "associated type bounds are unstable");
595+
// Despite being a new feature, `where T: Trait<Assoc(): Sized>`, which is RTN syntax now,
596+
// used to be gated under associated_type_bounds, which are right above, so RTN needs to
597+
// be too.
598+
gate_all_legacy_dont_use!(return_type_notation, "return type notation is experimental");
599+
gate_all_legacy_dont_use!(decl_macro, "`macro` is experimental");
600+
gate_all_legacy_dont_use!(box_patterns, "box pattern syntax is experimental");
601+
gate_all_legacy_dont_use!(
602+
exclusive_range_pattern,
603+
"exclusive range pattern syntax is experimental"
604+
);
605+
gate_all_legacy_dont_use!(try_blocks, "`try` blocks are unstable");
600606

601607
visit::walk_crate(&mut visitor, krate);
602608
}

0 commit comments

Comments
 (0)