about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2024-07-30 23:04:23 -0400
committerTrevor Gross <tmgross@umich.edu>2025-06-12 07:57:12 +0000
commit841f7ce69ac503fb9566deeefbbd273c1587f4e6 (patch)
tree287ebf2ad29bbaa5af7669b894864bef1c5ebb9d
parent208cb5da15d5a8378efff6d44a5ffa53fd51bbbc (diff)
downloadrust-841f7ce69ac503fb9566deeefbbd273c1587f4e6.tar.gz
rust-841f7ce69ac503fb9566deeefbbd273c1587f4e6.zip
Make `missing_fragment_specifier` an unconditional error
This was attempted in [1] then reverted in [2] because of fallout.
Recently, this was made an edition-dependent error in [3].

Make missing fragment specifiers an unconditional error again.

[1]: https://github.com/rust-lang/rust/pull/75516
[2]: https://github.com/rust-lang/rust/pull/80210
[3]: https://github.com/rust-lang/rust/pull/128006
-rw-r--r--compiler/rustc_expand/messages.ftl2
-rw-r--r--compiler/rustc_expand/src/mbe/macro_check.rs25
-rw-r--r--compiler/rustc_lint/messages.ftl2
-rw-r--r--compiler/rustc_lint/src/early/diagnostics.rs3
-rw-r--r--compiler/rustc_lint/src/lib.rs5
-rw-r--r--compiler/rustc_lint/src/lints.rs4
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs46
-rw-r--r--compiler/rustc_lint_defs/src/lib.rs1
-rw-r--r--tests/ui/lint/expansion-time.rs4
-rw-r--r--tests/ui/lint/expansion-time.stderr33
-rw-r--r--tests/ui/lint/future-incompatible-lint-group.rs19
-rw-r--r--tests/ui/lint/future-incompatible-lint-group.stderr44
-rw-r--r--tests/ui/macros/issue-39404.rs6
-rw-r--r--tests/ui/macros/issue-39404.stderr26
-rw-r--r--tests/ui/macros/macro-match-nonterminal.rs2
-rw-r--r--tests/ui/macros/macro-match-nonterminal.stderr39
-rw-r--r--tests/ui/macros/macro-missing-fragment-deduplication.rs6
-rw-r--r--tests/ui/macros/macro-missing-fragment-deduplication.stderr26
-rw-r--r--tests/ui/macros/macro-missing-fragment.e2015.stderr85
-rw-r--r--tests/ui/macros/macro-missing-fragment.rs24
-rw-r--r--tests/ui/macros/macro-missing-fragment.stderr (renamed from tests/ui/macros/macro-missing-fragment.e2024.stderr)14
-rw-r--r--tests/ui/parser/macro/issue-33569.rs1
-rw-r--r--tests/ui/parser/macro/issue-33569.stderr24
23 files changed, 102 insertions, 339 deletions
diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl
index 08b7a362083..8b7c47dad99 100644
--- a/compiler/rustc_expand/messages.ftl
+++ b/compiler/rustc_expand/messages.ftl
@@ -113,7 +113,7 @@ expand_meta_var_expr_unrecognized_var =
     variable `{$key}` is not recognized in meta-variable expression
 
 expand_missing_fragment_specifier = missing fragment specifier
-    .note = fragment specifiers must be specified in the 2024 edition
+    .note = fragment specifiers must be provided
     .suggestion_add_fragspec = try adding a specifier here
     .valid = {$valid}
 
diff --git a/compiler/rustc_expand/src/mbe/macro_check.rs b/compiler/rustc_expand/src/mbe/macro_check.rs
index 1a2db233b7a..3cd803c3e84 100644
--- a/compiler/rustc_expand/src/mbe/macro_check.rs
+++ b/compiler/rustc_expand/src/mbe/macro_check.rs
@@ -112,9 +112,8 @@ use rustc_ast::{DUMMY_NODE_ID, NodeId};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::MultiSpan;
 use rustc_lint_defs::BuiltinLintDiag;
-use rustc_session::lint::builtin::{META_VARIABLE_MISUSE, MISSING_FRAGMENT_SPECIFIER};
+use rustc_session::lint::builtin::META_VARIABLE_MISUSE;
 use rustc_session::parse::ParseSess;
-use rustc_span::edition::Edition;
 use rustc_span::{ErrorGuaranteed, MacroRulesNormalizedIdent, Span, kw};
 use smallvec::SmallVec;
 
@@ -266,23 +265,11 @@ fn check_binders(
         // Similarly, this can only happen when checking a toplevel macro.
         TokenTree::MetaVarDecl(span, name, kind) => {
             if kind.is_none() && node_id != DUMMY_NODE_ID {
-                // FIXME: Report this as a hard error eventually and remove equivalent errors from
-                // `parse_tt_inner` and `nameize`. Until then the error may be reported twice, once
-                // as a hard error and then once as a buffered lint.
-                if span.edition() >= Edition::Edition2024 {
-                    psess.dcx().emit_err(errors::MissingFragmentSpecifier {
-                        span,
-                        add_span: span.shrink_to_hi(),
-                        valid: VALID_FRAGMENT_NAMES_MSG,
-                    });
-                } else {
-                    psess.buffer_lint(
-                        MISSING_FRAGMENT_SPECIFIER,
-                        span,
-                        node_id,
-                        BuiltinLintDiag::MissingFragmentSpecifier,
-                    );
-                }
+                psess.dcx().emit_err(errors::MissingFragmentSpecifier {
+                    span,
+                    add_span: span.shrink_to_hi(),
+                    valid: VALID_FRAGMENT_NAMES_MSG,
+                });
             }
             if !macros.is_empty() {
                 psess.dcx().span_bug(span, "unexpected MetaVarDecl in nested lhs");
diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl
index fd2e2ba39ac..9a1db52fbd1 100644
--- a/compiler/rustc_lint/messages.ftl
+++ b/compiler/rustc_lint/messages.ftl
@@ -533,8 +533,6 @@ lint_mismatched_lifetime_syntaxes_suggestion_implicit =
 lint_mismatched_lifetime_syntaxes_suggestion_mixed =
     one option is to remove the lifetime for references and use the anonymous lifetime for paths
 
-lint_missing_fragment_specifier = missing fragment specifier
-
 lint_missing_unsafe_on_extern = extern blocks should be unsafe
     .suggestion = needs `unsafe` before the extern keyword
 
diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs
index 60c477dd6c7..3b0a36186b6 100644
--- a/compiler/rustc_lint/src/early/diagnostics.rs
+++ b/compiler/rustc_lint/src/early/diagnostics.rs
@@ -432,9 +432,6 @@ pub fn decorate_builtin_lint(
         BuiltinLintDiag::CfgAttrNoAttributes => {
             lints::CfgAttrNoAttributes.decorate_lint(diag);
         }
-        BuiltinLintDiag::MissingFragmentSpecifier => {
-            lints::MissingFragmentSpecifier.decorate_lint(diag);
-        }
         BuiltinLintDiag::MetaVariableStillRepeating(name) => {
             lints::MetaVariableStillRepeating { name }.decorate_lint(diag);
         }
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 72bfeaddbf1..547539d7273 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -619,6 +619,11 @@ fn register_builtins(store: &mut LintStore) {
         "converted into hard error, \
          see <https://github.com/rust-lang/rust/issues/116558> for more information",
     );
+    store.register_removed(
+        "missing_fragment_specifier",
+        "converted into hard error, \
+         see <https://github.com/rust-lang/rust/issues/40107> for more information",
+    );
 }
 
 fn register_internals(store: &mut LintStore) {
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index 9d3c74a9a2b..25acde53367 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -2617,10 +2617,6 @@ pub(crate) struct DuplicateMacroAttribute;
 pub(crate) struct CfgAttrNoAttributes;
 
 #[derive(LintDiagnostic)]
-#[diag(lint_missing_fragment_specifier)]
-pub(crate) struct MissingFragmentSpecifier;
-
-#[derive(LintDiagnostic)]
 #[diag(lint_metavariable_still_repeating)]
 pub(crate) struct MetaVariableStillRepeating {
     pub name: MacroRulesNormalizedIdent,
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 777118e69fb..174619e5ad9 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -65,7 +65,6 @@ declare_lint_pass! {
         MACRO_USE_EXTERN_CRATE,
         META_VARIABLE_MISUSE,
         MISSING_ABI,
-        MISSING_FRAGMENT_SPECIFIER,
         MISSING_UNSAFE_ON_EXTERN,
         MUST_NOT_SUSPEND,
         NAMED_ARGUMENTS_USED_POSITIONALLY,
@@ -1418,51 +1417,6 @@ declare_lint! {
 }
 
 declare_lint! {
-    /// The `missing_fragment_specifier` lint is issued when an unused pattern in a
-    /// `macro_rules!` macro definition has a meta-variable (e.g. `$e`) that is not
-    /// followed by a fragment specifier (e.g. `:expr`).
-    ///
-    /// This warning can always be fixed by removing the unused pattern in the
-    /// `macro_rules!` macro definition.
-    ///
-    /// ### Example
-    ///
-    /// ```rust,compile_fail,edition2021
-    /// macro_rules! foo {
-    ///    () => {};
-    ///    ($name) => { };
-    /// }
-    ///
-    /// fn main() {
-    ///    foo!();
-    /// }
-    /// ```
-    ///
-    /// {{produces}}
-    ///
-    /// ### Explanation
-    ///
-    /// To fix this, remove the unused pattern from the `macro_rules!` macro definition:
-    ///
-    /// ```rust
-    /// macro_rules! foo {
-    ///     () => {};
-    /// }
-    /// fn main() {
-    ///     foo!();
-    /// }
-    /// ```
-    pub MISSING_FRAGMENT_SPECIFIER,
-    Deny,
-    "detects missing fragment specifiers in unused `macro_rules!` patterns",
-    @future_incompatible = FutureIncompatibleInfo {
-        reason: FutureIncompatibilityReason::FutureReleaseError,
-        reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
-        report_in_deps: true,
-    };
-}
-
-declare_lint! {
     /// The `late_bound_lifetime_arguments` lint detects generic lifetime
     /// arguments in path segments with late bound lifetime parameters.
     ///
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs
index 1d9b7a7fcb9..cd402c9234f 100644
--- a/compiler/rustc_lint_defs/src/lib.rs
+++ b/compiler/rustc_lint_defs/src/lib.rs
@@ -778,7 +778,6 @@ pub enum BuiltinLintDiag {
     UnnameableTestItems,
     DuplicateMacroAttribute,
     CfgAttrNoAttributes,
-    MissingFragmentSpecifier,
     MetaVariableStillRepeating(MacroRulesNormalizedIdent),
     MetaVariableWrongOperator,
     DuplicateMatcherBinding,
diff --git a/tests/ui/lint/expansion-time.rs b/tests/ui/lint/expansion-time.rs
index 5ffb0c7881e..2c59bf00065 100644
--- a/tests/ui/lint/expansion-time.rs
+++ b/tests/ui/lint/expansion-time.rs
@@ -5,10 +5,6 @@ macro_rules! foo {
     ( $($i:ident)* ) => { $($i)+ }; //~ WARN meta-variable repeats with different Kleene operator
 }
 
-#[warn(missing_fragment_specifier)]
-macro_rules! m { ($i) => {} } //~ WARN missing fragment specifier
-                              //~| WARN this was previously accepted
-
 #[deprecated = "reason"]
 macro_rules! deprecated {
     () => {}
diff --git a/tests/ui/lint/expansion-time.stderr b/tests/ui/lint/expansion-time.stderr
index f24d1b68a8d..b1154d1a54c 100644
--- a/tests/ui/lint/expansion-time.stderr
+++ b/tests/ui/lint/expansion-time.stderr
@@ -12,20 +12,6 @@ note: the lint level is defined here
 LL | #[warn(meta_variable_misuse)]
    |        ^^^^^^^^^^^^^^^^^^^^
 
-warning: missing fragment specifier
-  --> $DIR/expansion-time.rs:9:19
-   |
-LL | macro_rules! m { ($i) => {} }
-   |                   ^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-note: the lint level is defined here
-  --> $DIR/expansion-time.rs:8:8
-   |
-LL | #[warn(missing_fragment_specifier)]
-   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 warning: include macro expected single expression in source
   --> $DIR/expansion-time-include.rs:4:1
    |
@@ -33,25 +19,10 @@ LL | 2
    | ^
    |
 note: the lint level is defined here
-  --> $DIR/expansion-time.rs:22:8
+  --> $DIR/expansion-time.rs:18:8
    |
 LL | #[warn(incomplete_include)]
    |        ^^^^^^^^^^^^^^^^^^
 
-warning: 3 warnings emitted
-
-Future incompatibility report: Future breakage diagnostic:
-warning: missing fragment specifier
-  --> $DIR/expansion-time.rs:9:19
-   |
-LL | macro_rules! m { ($i) => {} }
-   |                   ^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-note: the lint level is defined here
-  --> $DIR/expansion-time.rs:8:8
-   |
-LL | #[warn(missing_fragment_specifier)]
-   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^
+warning: 2 warnings emitted
 
diff --git a/tests/ui/lint/future-incompatible-lint-group.rs b/tests/ui/lint/future-incompatible-lint-group.rs
index d1adcf21cdc..22a7ccb463b 100644
--- a/tests/ui/lint/future-incompatible-lint-group.rs
+++ b/tests/ui/lint/future-incompatible-lint-group.rs
@@ -4,14 +4,23 @@
 // lints for changes that are not tied to an edition
 #![deny(future_incompatible)]
 
-// Error since this is a `future_incompatible` lint
-macro_rules! m {
-    ($i) => {};
-    //~^ ERROR missing fragment specifier
+enum E { V }
+
+trait Tr1 {
+    type V;
+    fn foo() -> Self::V;
+}
+
+impl Tr1 for E {
+    type V = u8;
+
+    // Error since this is a `future_incompatible` lint
+    fn foo() -> Self::V { 0 }
+    //~^ ERROR ambiguous associated item
     //~| WARN this was previously accepted
 }
 
-trait Tr {
+trait Tr2 {
     // Warn only since this is not a `future_incompatible` lint
     fn f(u8) {}
     //~^ WARN anonymous parameters are deprecated
diff --git a/tests/ui/lint/future-incompatible-lint-group.stderr b/tests/ui/lint/future-incompatible-lint-group.stderr
index 264911b46d4..87b9ebec08b 100644
--- a/tests/ui/lint/future-incompatible-lint-group.stderr
+++ b/tests/ui/lint/future-incompatible-lint-group.stderr
@@ -1,20 +1,5 @@
-error: missing fragment specifier
-  --> $DIR/future-incompatible-lint-group.rs:9:6
-   |
-LL |     ($i) => {};
-   |      ^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-note: the lint level is defined here
-  --> $DIR/future-incompatible-lint-group.rs:5:9
-   |
-LL | #![deny(future_incompatible)]
-   |         ^^^^^^^^^^^^^^^^^^^
-   = note: `#[deny(missing_fragment_specifier)]` implied by `#[deny(future_incompatible)]`
-
 warning: anonymous parameters are deprecated and will be removed in the next edition
-  --> $DIR/future-incompatible-lint-group.rs:16:10
+  --> $DIR/future-incompatible-lint-group.rs:25:10
    |
 LL |     fn f(u8) {}
    |          ^^ help: try naming the parameter or explicitly ignoring it: `_: u8`
@@ -23,21 +8,30 @@ LL |     fn f(u8) {}
    = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
    = note: `#[warn(anonymous_parameters)]` on by default
 
-error: aborting due to 1 previous error; 1 warning emitted
-
-Future incompatibility report: Future breakage diagnostic:
-error: missing fragment specifier
-  --> $DIR/future-incompatible-lint-group.rs:9:6
+error: ambiguous associated item
+  --> $DIR/future-incompatible-lint-group.rs:18:17
    |
-LL |     ($i) => {};
-   |      ^^
+LL |     fn foo() -> Self::V { 0 }
+   |                 ^^^^^^^ help: use fully-qualified syntax: `<E as Tr1>::V`
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
+   = note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644>
+note: `V` could refer to the variant defined here
+  --> $DIR/future-incompatible-lint-group.rs:7:10
+   |
+LL | enum E { V }
+   |          ^
+note: `V` could also refer to the associated type defined here
+  --> $DIR/future-incompatible-lint-group.rs:10:5
+   |
+LL |     type V;
+   |     ^^^^^^
 note: the lint level is defined here
   --> $DIR/future-incompatible-lint-group.rs:5:9
    |
 LL | #![deny(future_incompatible)]
    |         ^^^^^^^^^^^^^^^^^^^
-   = note: `#[deny(missing_fragment_specifier)]` implied by `#[deny(future_incompatible)]`
+   = note: `#[deny(ambiguous_associated_items)]` implied by `#[deny(future_incompatible)]`
+
+error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/macros/issue-39404.rs b/tests/ui/macros/issue-39404.rs
index 2229f2c3900..ceeb6231bc8 100644
--- a/tests/ui/macros/issue-39404.rs
+++ b/tests/ui/macros/issue-39404.rs
@@ -1,7 +1,7 @@
 #![allow(unused)]
 
-macro_rules! m { ($i) => {} }
-//~^ ERROR missing fragment specifier
-//~| WARN previously accepted
+macro_rules! m {
+    ($i) => {}; //~ ERROR missing fragment specifier
+}
 
 fn main() {}
diff --git a/tests/ui/macros/issue-39404.stderr b/tests/ui/macros/issue-39404.stderr
index 176c8e9f073..62d0bc1018c 100644
--- a/tests/ui/macros/issue-39404.stderr
+++ b/tests/ui/macros/issue-39404.stderr
@@ -1,23 +1,15 @@
 error: missing fragment specifier
-  --> $DIR/issue-39404.rs:3:19
+  --> $DIR/issue-39404.rs:4:6
    |
-LL | macro_rules! m { ($i) => {} }
-   |                   ^^
+LL |     ($i) => {};
+   |      ^^
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
+   = note: fragment specifiers must be provided
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
+help: try adding a specifier here
+   |
+LL |     ($i:spec) => {};
+   |        +++++
 
 error: aborting due to 1 previous error
 
-Future incompatibility report: Future breakage diagnostic:
-error: missing fragment specifier
-  --> $DIR/issue-39404.rs:3:19
-   |
-LL | macro_rules! m { ($i) => {} }
-   |                   ^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
-
diff --git a/tests/ui/macros/macro-match-nonterminal.rs b/tests/ui/macros/macro-match-nonterminal.rs
index 5d9eb55fee0..fa2af945a1f 100644
--- a/tests/ui/macros/macro-match-nonterminal.rs
+++ b/tests/ui/macros/macro-match-nonterminal.rs
@@ -3,8 +3,6 @@ macro_rules! test {
         //~^ ERROR missing fragment
         //~| ERROR missing fragment
         //~| ERROR missing fragment
-        //~| WARN this was previously accepted
-        //~| WARN this was previously accepted
         ()
     };
 }
diff --git a/tests/ui/macros/macro-match-nonterminal.stderr b/tests/ui/macros/macro-match-nonterminal.stderr
index f221f92c3cd..8196d795c4c 100644
--- a/tests/ui/macros/macro-match-nonterminal.stderr
+++ b/tests/ui/macros/macro-match-nonterminal.stderr
@@ -3,16 +3,13 @@ error: missing fragment specifier
    |
 LL |     ($a, $b) => {
    |      ^^
-
-error: missing fragment specifier
-  --> $DIR/macro-match-nonterminal.rs:2:6
    |
-LL |     ($a, $b) => {
-   |      ^^
+   = note: fragment specifiers must be provided
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
+help: try adding a specifier here
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
+LL |     ($a:spec, $b) => {
+   |        +++++
 
 error: missing fragment specifier
   --> $DIR/macro-match-nonterminal.rs:2:10
@@ -20,30 +17,18 @@ error: missing fragment specifier
 LL |     ($a, $b) => {
    |          ^^
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-
-error: aborting due to 3 previous errors
+   = note: fragment specifiers must be provided
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
+help: try adding a specifier here
+   |
+LL |     ($a, $b:spec) => {
+   |            +++++
 
-Future incompatibility report: Future breakage diagnostic:
 error: missing fragment specifier
   --> $DIR/macro-match-nonterminal.rs:2:6
    |
 LL |     ($a, $b) => {
    |      ^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
 
-Future breakage diagnostic:
-error: missing fragment specifier
-  --> $DIR/macro-match-nonterminal.rs:2:10
-   |
-LL |     ($a, $b) => {
-   |          ^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
+error: aborting due to 3 previous errors
 
diff --git a/tests/ui/macros/macro-missing-fragment-deduplication.rs b/tests/ui/macros/macro-missing-fragment-deduplication.rs
index b77c51e055b..481f08fa111 100644
--- a/tests/ui/macros/macro-missing-fragment-deduplication.rs
+++ b/tests/ui/macros/macro-missing-fragment-deduplication.rs
@@ -1,10 +1,8 @@
 //@ compile-flags: -Zdeduplicate-diagnostics=yes
 
 macro_rules! m {
-    ($name) => {}
-    //~^ ERROR missing fragment
-    //~| ERROR missing fragment
-    //~| WARN this was previously accepted
+    ($name) => {}; //~ ERROR missing fragment
+                   //~| ERROR missing fragment
 }
 
 fn main() {
diff --git a/tests/ui/macros/macro-missing-fragment-deduplication.stderr b/tests/ui/macros/macro-missing-fragment-deduplication.stderr
index c46712f70fd..820f7eb3cf7 100644
--- a/tests/ui/macros/macro-missing-fragment-deduplication.stderr
+++ b/tests/ui/macros/macro-missing-fragment-deduplication.stderr
@@ -1,29 +1,21 @@
 error: missing fragment specifier
   --> $DIR/macro-missing-fragment-deduplication.rs:4:6
    |
-LL |     ($name) => {}
+LL |     ($name) => {};
    |      ^^^^^
-
-error: missing fragment specifier
-  --> $DIR/macro-missing-fragment-deduplication.rs:4:6
    |
-LL |     ($name) => {}
-   |      ^^^^^
+   = note: fragment specifiers must be provided
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
+help: try adding a specifier here
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
+LL |     ($name:spec) => {};
+   |           +++++
 
-error: aborting due to 2 previous errors
-
-Future incompatibility report: Future breakage diagnostic:
 error: missing fragment specifier
   --> $DIR/macro-missing-fragment-deduplication.rs:4:6
    |
-LL |     ($name) => {}
+LL |     ($name) => {};
    |      ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
+
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/macros/macro-missing-fragment.e2015.stderr b/tests/ui/macros/macro-missing-fragment.e2015.stderr
deleted file mode 100644
index 3d32f203d4a..00000000000
--- a/tests/ui/macros/macro-missing-fragment.e2015.stderr
+++ /dev/null
@@ -1,85 +0,0 @@
-error: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:8:20
-   |
-LL |     ( $( any_token $field_rust_type )* ) => {};
-   |                    ^^^^^^^^^^^^^^^^
-
-warning: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:8:20
-   |
-LL |     ( $( any_token $field_rust_type )* ) => {};
-   |                    ^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-note: the lint level is defined here
-  --> $DIR/macro-missing-fragment.rs:5:9
-   |
-LL | #![warn(missing_fragment_specifier)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:18:7
-   |
-LL |     ( $name ) => {};
-   |       ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-
-warning: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:25:7
-   |
-LL |     ( $name ) => {};
-   |       ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-
-error: aborting due to 1 previous error; 3 warnings emitted
-
-Future incompatibility report: Future breakage diagnostic:
-warning: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:8:20
-   |
-LL |     ( $( any_token $field_rust_type )* ) => {};
-   |                    ^^^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-note: the lint level is defined here
-  --> $DIR/macro-missing-fragment.rs:5:9
-   |
-LL | #![warn(missing_fragment_specifier)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Future breakage diagnostic:
-warning: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:18:7
-   |
-LL |     ( $name ) => {};
-   |       ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-note: the lint level is defined here
-  --> $DIR/macro-missing-fragment.rs:5:9
-   |
-LL | #![warn(missing_fragment_specifier)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Future breakage diagnostic:
-warning: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:25:7
-   |
-LL |     ( $name ) => {};
-   |       ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-note: the lint level is defined here
-  --> $DIR/macro-missing-fragment.rs:5:9
-   |
-LL | #![warn(missing_fragment_specifier)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
diff --git a/tests/ui/macros/macro-missing-fragment.rs b/tests/ui/macros/macro-missing-fragment.rs
index 42387e8dbbf..533aa147bcb 100644
--- a/tests/ui/macros/macro-missing-fragment.rs
+++ b/tests/ui/macros/macro-missing-fragment.rs
@@ -1,31 +1,17 @@
-//@ revisions: e2015 e2024
-//@[e2015] edition:2015
-//@[e2024] edition:2024
-
-#![warn(missing_fragment_specifier)]
+//! Ensure that macros produce an error if fragment specifiers are missing.
 
 macro_rules! used_arm {
-    ( $( any_token $field_rust_type )* ) => {};
-    //[e2015]~^ ERROR missing fragment
-    //[e2015]~| WARN missing fragment
-    //[e2015]~| WARN this was previously accepted
-    //[e2024]~^^^^ ERROR missing fragment
-    //[e2024]~| ERROR missing fragment
+    ( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment
+                                                //~| ERROR missing fragment
 }
 
 macro_rules! used_macro_unused_arm {
     () => {};
-    ( $name ) => {};
-    //[e2015]~^ WARN missing fragment
-    //[e2015]~| WARN this was previously accepted
-    //[e2024]~^^^ ERROR missing fragment
+    ( $name ) => {}; //~ ERROR missing fragment
 }
 
 macro_rules! unused_macro {
-    ( $name ) => {};
-    //[e2015]~^ WARN missing fragment
-    //[e2015]~| WARN this was previously accepted
-    //[e2024]~^^^ ERROR missing fragment
+    ( $name ) => {}; //~ ERROR missing fragment
 }
 
 fn main() {
diff --git a/tests/ui/macros/macro-missing-fragment.e2024.stderr b/tests/ui/macros/macro-missing-fragment.stderr
index a9195063a5b..4a99d7d949c 100644
--- a/tests/ui/macros/macro-missing-fragment.e2024.stderr
+++ b/tests/ui/macros/macro-missing-fragment.stderr
@@ -1,10 +1,10 @@
 error: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:8:20
+  --> $DIR/macro-missing-fragment.rs:4:20
    |
 LL |     ( $( any_token $field_rust_type )* ) => {};
    |                    ^^^^^^^^^^^^^^^^
    |
-   = note: fragment specifiers must be specified in the 2024 edition
+   = note: fragment specifiers must be provided
    = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
 help: try adding a specifier here
    |
@@ -12,12 +12,12 @@ LL |     ( $( any_token $field_rust_type:spec )* ) => {};
    |                                    +++++
 
 error: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:18:7
+  --> $DIR/macro-missing-fragment.rs:10:7
    |
 LL |     ( $name ) => {};
    |       ^^^^^
    |
-   = note: fragment specifiers must be specified in the 2024 edition
+   = note: fragment specifiers must be provided
    = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
 help: try adding a specifier here
    |
@@ -25,12 +25,12 @@ LL |     ( $name:spec ) => {};
    |            +++++
 
 error: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:25:7
+  --> $DIR/macro-missing-fragment.rs:14:7
    |
 LL |     ( $name ) => {};
    |       ^^^^^
    |
-   = note: fragment specifiers must be specified in the 2024 edition
+   = note: fragment specifiers must be provided
    = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
 help: try adding a specifier here
    |
@@ -38,7 +38,7 @@ LL |     ( $name:spec ) => {};
    |            +++++
 
 error: missing fragment specifier
-  --> $DIR/macro-missing-fragment.rs:8:20
+  --> $DIR/macro-missing-fragment.rs:4:20
    |
 LL |     ( $( any_token $field_rust_type )* ) => {};
    |                    ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/parser/macro/issue-33569.rs b/tests/ui/parser/macro/issue-33569.rs
index 069d181e962..e0a5352ab06 100644
--- a/tests/ui/parser/macro/issue-33569.rs
+++ b/tests/ui/parser/macro/issue-33569.rs
@@ -2,7 +2,6 @@ macro_rules! foo {
     { $+ } => { //~ ERROR expected identifier, found `+`
                 //~^ ERROR missing fragment specifier
                 //~| ERROR missing fragment specifier
-                //~| WARN this was previously accepted
         $(x)(y) //~ ERROR expected one of: `*`, `+`, or `?`
     }
 }
diff --git a/tests/ui/parser/macro/issue-33569.stderr b/tests/ui/parser/macro/issue-33569.stderr
index d1b6abfeeeb..0d53c04c1c9 100644
--- a/tests/ui/parser/macro/issue-33569.stderr
+++ b/tests/ui/parser/macro/issue-33569.stderr
@@ -5,7 +5,7 @@ LL |     { $+ } => {
    |        ^
 
 error: expected one of: `*`, `+`, or `?`
-  --> $DIR/issue-33569.rs:6:13
+  --> $DIR/issue-33569.rs:5:13
    |
 LL |         $(x)(y)
    |             ^^^
@@ -15,27 +15,19 @@ error: missing fragment specifier
    |
 LL |     { $+ } => {
    |        ^
-
-error: missing fragment specifier
-  --> $DIR/issue-33569.rs:2:8
    |
-LL |     { $+ } => {
-   |        ^
+   = note: fragment specifiers must be provided
+   = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`, along with `expr_2021` and `pat_param` for edition compatibility
+help: try adding a specifier here
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
+LL |     { $+:spec } => {
+   |         +++++
 
-error: aborting due to 4 previous errors
-
-Future incompatibility report: Future breakage diagnostic:
 error: missing fragment specifier
   --> $DIR/issue-33569.rs:2:8
    |
 LL |     { $+ } => {
    |        ^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
-   = note: `#[deny(missing_fragment_specifier)]` on by default
+
+error: aborting due to 4 previous errors