Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 063c08d

Browse files
committedJul 31, 2024·
Auto merge of rust-lang#128425 - tgross35:missing-fragment-specifier-unconditional, r=<try>
[crater] 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]. Experiment with turning missing fragment specifiers an unconditional error again. More context: rust-lang#128006 [1]: rust-lang#75516 [2]: rust-lang#80210 [3]: rust-lang#128006
2 parents 83dcdb3 + c2492ec commit 063c08d

21 files changed

+66
-313
lines changed
 

‎compiler/rustc_expand/src/mbe/macro_check.rs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ use rustc_ast::{NodeId, DUMMY_NODE_ID};
112112
use rustc_data_structures::fx::FxHashMap;
113113
use rustc_errors::MultiSpan;
114114
use rustc_lint_defs::BuiltinLintDiag;
115-
use rustc_session::lint::builtin::{META_VARIABLE_MISUSE, MISSING_FRAGMENT_SPECIFIER};
115+
use rustc_session::lint::builtin::META_VARIABLE_MISUSE;
116116
use rustc_session::parse::ParseSess;
117-
use rustc_span::edition::Edition;
118117
use rustc_span::symbol::{kw, MacroRulesNormalizedIdent};
119118
use rustc_span::{ErrorGuaranteed, Span};
120119
use smallvec::SmallVec;
@@ -267,23 +266,11 @@ fn check_binders(
267266
// Similarly, this can only happen when checking a toplevel macro.
268267
TokenTree::MetaVarDecl(span, name, kind) => {
269268
if kind.is_none() && node_id != DUMMY_NODE_ID {
270-
// FIXME: Report this as a hard error eventually and remove equivalent errors from
271-
// `parse_tt_inner` and `nameize`. Until then the error may be reported twice, once
272-
// as a hard error and then once as a buffered lint.
273-
if span.edition() >= Edition::Edition2024 {
274-
psess.dcx().emit_err(errors::MissingFragmentSpecifier {
275-
span,
276-
add_span: span.shrink_to_hi(),
277-
valid: VALID_FRAGMENT_NAMES_MSG_2021,
278-
});
279-
} else {
280-
psess.buffer_lint(
281-
MISSING_FRAGMENT_SPECIFIER,
282-
span,
283-
node_id,
284-
BuiltinLintDiag::MissingFragmentSpecifier,
285-
);
286-
}
269+
psess.dcx().emit_err(errors::MissingFragmentSpecifier {
270+
span,
271+
add_span: span.shrink_to_hi(),
272+
valid: VALID_FRAGMENT_NAMES_MSG_2021,
273+
});
287274
}
288275
if !macros.is_empty() {
289276
psess.dcx().span_bug(span, "unexpected MetaVarDecl in nested lhs");

‎compiler/rustc_lint/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,6 @@ lint_metavariable_still_repeating = variable `{$name}` is still repeating at thi
489489
490490
lint_metavariable_wrong_operator = meta-variable repeats with different Kleene operator
491491
492-
lint_missing_fragment_specifier = missing fragment specifier
493-
494492
lint_missing_unsafe_on_extern = extern blocks should be unsafe
495493
.suggestion = needs `unsafe` before the extern keyword
496494

‎compiler/rustc_lint/src/context/diagnostics.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,6 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: &
401401
BuiltinLintDiag::CrateNameInCfgAttr => {
402402
lints::CrateNameInCfgAttr.decorate_lint(diag);
403403
}
404-
BuiltinLintDiag::MissingFragmentSpecifier => {
405-
lints::MissingFragmentSpecifier.decorate_lint(diag);
406-
}
407404
BuiltinLintDiag::MetaVariableStillRepeating(name) => {
408405
lints::MetaVariableStillRepeating { name }.decorate_lint(diag);
409406
}

‎compiler/rustc_lint/src/lints.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,10 +2459,6 @@ pub struct CrateTypeInCfgAttr;
24592459
#[diag(lint_crate_name_in_cfg_attr_deprecated)]
24602460
pub struct CrateNameInCfgAttr;
24612461

2462-
#[derive(LintDiagnostic)]
2463-
#[diag(lint_missing_fragment_specifier)]
2464-
pub struct MissingFragmentSpecifier;
2465-
24662462
#[derive(LintDiagnostic)]
24672463
#[diag(lint_metavariable_still_repeating)]
24682464
pub struct MetaVariableStillRepeating {

‎compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ declare_lint_pass! {
6666
MACRO_USE_EXTERN_CRATE,
6767
META_VARIABLE_MISUSE,
6868
MISSING_ABI,
69-
MISSING_FRAGMENT_SPECIFIER,
7069
MISSING_UNSAFE_ON_EXTERN,
7170
MUST_NOT_SUSPEND,
7271
NAMED_ARGUMENTS_USED_POSITIONALLY,
@@ -1385,50 +1384,6 @@ declare_lint! {
13851384
};
13861385
}
13871386

1388-
declare_lint! {
1389-
/// The `missing_fragment_specifier` lint is issued when an unused pattern in a
1390-
/// `macro_rules!` macro definition has a meta-variable (e.g. `$e`) that is not
1391-
/// followed by a fragment specifier (e.g. `:expr`).
1392-
///
1393-
/// This warning can always be fixed by removing the unused pattern in the
1394-
/// `macro_rules!` macro definition.
1395-
///
1396-
/// ### Example
1397-
///
1398-
/// ```rust,compile_fail
1399-
/// macro_rules! foo {
1400-
/// () => {};
1401-
/// ($name) => { };
1402-
/// }
1403-
///
1404-
/// fn main() {
1405-
/// foo!();
1406-
/// }
1407-
/// ```
1408-
///
1409-
/// {{produces}}
1410-
///
1411-
/// ### Explanation
1412-
///
1413-
/// To fix this, remove the unused pattern from the `macro_rules!` macro definition:
1414-
///
1415-
/// ```rust
1416-
/// macro_rules! foo {
1417-
/// () => {};
1418-
/// }
1419-
/// fn main() {
1420-
/// foo!();
1421-
/// }
1422-
/// ```
1423-
pub MISSING_FRAGMENT_SPECIFIER,
1424-
Deny,
1425-
"detects missing fragment specifiers in unused `macro_rules!` patterns",
1426-
@future_incompatible = FutureIncompatibleInfo {
1427-
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
1428-
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
1429-
};
1430-
}
1431-
14321387
declare_lint! {
14331388
/// The `late_bound_lifetime_arguments` lint detects generic lifetime
14341389
/// arguments in path segments with late bound lifetime parameters.

‎compiler/rustc_lint_defs/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ pub enum BuiltinLintDiag {
727727
CfgAttrNoAttributes,
728728
CrateTypeInCfgAttr,
729729
CrateNameInCfgAttr,
730-
MissingFragmentSpecifier,
731730
MetaVariableStillRepeating(MacroRulesNormalizedIdent),
732731
MetaVariableWrongOperator,
733732
DuplicateMatcherBinding,

‎tests/rustdoc/macro-generated-macro.macro_morestuff_pre.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
macro_rules! morestuff {
22
(
3-
<= "space between most kinds of tokens" : 1 $x + @ :: >>= 'static
4-
"no space inside paren or bracket" : (2 a) [2 a] $(2 $a:tt)*
3+
<= "space between most kinds of tokens" : 1 $x:ident + @ :: >>=
4+
'static "no space inside paren or bracket" : (2 a) [2 a] $(2 $a:tt)*
55
"space inside curly brace" : { 2 a }
66
"no space inside empty delimiters" : () [] {}
77
"no space before comma or semicolon" : a, (a), { a }, a; [T; 0];

‎tests/rustdoc/macro-generated-macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ make_macro!(linebreak 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
2525

2626
//@ snapshot macro_morestuff_pre macro_generated_macro/macro.morestuff.html //pre/text()
2727
make_macro!(morestuff
28-
"space between most kinds of tokens": 1 $x + @ :: >>= 'static
28+
"space between most kinds of tokens": 1 $x:ident + @ :: >>= 'static
2929
"no space inside paren or bracket": (2 a) [2 a] $(2 $a:tt)*
3030
"space inside curly brace": { 2 a }
3131
"no space inside empty delimiters": () [] {}

‎tests/ui/lint/expansion-time.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ macro_rules! foo {
55
( $($i:ident)* ) => { $($i)+ }; //~ WARN meta-variable repeats with different Kleene operator
66
}
77

8-
#[warn(missing_fragment_specifier)]
9-
macro_rules! m { ($i) => {} } //~ WARN missing fragment specifier
10-
//~| WARN this was previously accepted
11-
128
#[warn(soft_unstable)]
139
mod benches {
1410
#[bench] //~ WARN use of unstable library feature 'test'

‎tests/ui/lint/expansion-time.stderr

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,16 @@ note: the lint level is defined here
1212
LL | #[warn(meta_variable_misuse)]
1313
| ^^^^^^^^^^^^^^^^^^^^
1414

15-
warning: missing fragment specifier
16-
--> $DIR/expansion-time.rs:9:19
17-
|
18-
LL | macro_rules! m { ($i) => {} }
19-
| ^^
20-
|
21-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
23-
note: the lint level is defined here
24-
--> $DIR/expansion-time.rs:8:8
25-
|
26-
LL | #[warn(missing_fragment_specifier)]
27-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
28-
2915
warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
30-
--> $DIR/expansion-time.rs:14:7
16+
--> $DIR/expansion-time.rs:10:7
3117
|
3218
LL | #[bench]
3319
| ^^^^^
3420
|
3521
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3622
= note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
3723
note: the lint level is defined here
38-
--> $DIR/expansion-time.rs:12:8
24+
--> $DIR/expansion-time.rs:8:8
3925
|
4026
LL | #[warn(soft_unstable)]
4127
| ^^^^^^^^^^^^^
@@ -47,39 +33,24 @@ LL | 2
4733
| ^
4834
|
4935
note: the lint level is defined here
50-
--> $DIR/expansion-time.rs:29:8
36+
--> $DIR/expansion-time.rs:25:8
5137
|
5238
LL | #[warn(incomplete_include)]
5339
| ^^^^^^^^^^^^^^^^^^
5440

55-
warning: 4 warnings emitted
41+
warning: 3 warnings emitted
5642

5743
Future incompatibility report: Future breakage diagnostic:
58-
warning: missing fragment specifier
59-
--> $DIR/expansion-time.rs:9:19
60-
|
61-
LL | macro_rules! m { ($i) => {} }
62-
| ^^
63-
|
64-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
65-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
66-
note: the lint level is defined here
67-
--> $DIR/expansion-time.rs:8:8
68-
|
69-
LL | #[warn(missing_fragment_specifier)]
70-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
71-
72-
Future breakage diagnostic:
7344
warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
74-
--> $DIR/expansion-time.rs:14:7
45+
--> $DIR/expansion-time.rs:10:7
7546
|
7647
LL | #[bench]
7748
| ^^^^^
7849
|
7950
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8051
= note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
8152
note: the lint level is defined here
82-
--> $DIR/expansion-time.rs:12:8
53+
--> $DIR/expansion-time.rs:8:8
8354
|
8455
LL | #[warn(soft_unstable)]
8556
| ^^^^^^^^^^^^^

‎tests/ui/macros/issue-39404.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(unused)]
22

3-
macro_rules! m { ($i) => {} }
4-
//~^ ERROR missing fragment specifier
5-
//~| WARN previously accepted
3+
macro_rules! m {
4+
($i) => {}; //~ ERROR missing fragment specifier
5+
}
66

77
fn main() {}

‎tests/ui/macros/issue-39404.stderr

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
error: missing fragment specifier
2-
--> $DIR/issue-39404.rs:3:19
2+
--> $DIR/issue-39404.rs:4:6
33
|
4-
LL | macro_rules! m { ($i) => {} }
5-
| ^^
4+
LL | ($i) => {};
5+
| ^^
66
|
7-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
9-
= note: `#[deny(missing_fragment_specifier)]` on by default
7+
= note: fragment specifiers must be specified in the 2024 edition
8+
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `expr_2021`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
9+
help: try adding a specifier here
10+
|
11+
LL | ($i:spec) => {};
12+
| +++++
1013

1114
error: aborting due to 1 previous error
1215

13-
Future incompatibility report: Future breakage diagnostic:
14-
error: missing fragment specifier
15-
--> $DIR/issue-39404.rs:3:19
16-
|
17-
LL | macro_rules! m { ($i) => {} }
18-
| ^^
19-
|
20-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
21-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
22-
= note: `#[deny(missing_fragment_specifier)]` on by default
23-

‎tests/ui/macros/macro-match-nonterminal.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ macro_rules! test {
33
//~^ ERROR missing fragment
44
//~| ERROR missing fragment
55
//~| ERROR missing fragment
6-
//~| WARN this was previously accepted
7-
//~| WARN this was previously accepted
86
()
97
};
108
}

‎tests/ui/macros/macro-match-nonterminal.stderr

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,32 @@ error: missing fragment specifier
33
|
44
LL | ($a, $b) => {
55
| ^
6-
7-
error: missing fragment specifier
8-
--> $DIR/macro-match-nonterminal.rs:2:8
96
|
10-
LL | ($a, $b) => {
11-
| ^
7+
= note: fragment specifiers must be specified in the 2024 edition
8+
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `expr_2021`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
9+
help: try adding a specifier here
1210
|
13-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
15-
= note: `#[deny(missing_fragment_specifier)]` on by default
11+
LL | ($a,:spec $b) => {
12+
| +++++
1613

1714
error: missing fragment specifier
1815
--> $DIR/macro-match-nonterminal.rs:2:10
1916
|
2017
LL | ($a, $b) => {
2118
| ^^
2219
|
23-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
24-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
25-
26-
error: aborting due to 3 previous errors
20+
= note: fragment specifiers must be specified in the 2024 edition
21+
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `expr_2021`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
22+
help: try adding a specifier here
23+
|
24+
LL | ($a, $b:spec) => {
25+
| +++++
2726

28-
Future incompatibility report: Future breakage diagnostic:
2927
error: missing fragment specifier
3028
--> $DIR/macro-match-nonterminal.rs:2:8
3129
|
3230
LL | ($a, $b) => {
3331
| ^
34-
|
35-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
36-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
37-
= note: `#[deny(missing_fragment_specifier)]` on by default
3832

39-
Future breakage diagnostic:
40-
error: missing fragment specifier
41-
--> $DIR/macro-match-nonterminal.rs:2:10
42-
|
43-
LL | ($a, $b) => {
44-
| ^^
45-
|
46-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
47-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
48-
= note: `#[deny(missing_fragment_specifier)]` on by default
33+
error: aborting due to 3 previous errors
4934

‎tests/ui/macros/macro-missing-fragment-deduplication.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
//@ compile-flags: -Zdeduplicate-diagnostics=yes
22

33
macro_rules! m {
4-
($name) => {}
5-
//~^ ERROR missing fragment
6-
//~| ERROR missing fragment
7-
//~| WARN this was previously accepted
4+
($name) => {}; //~ ERROR missing fragment
5+
//~| ERROR missing fragment
86
}
97

108
fn main() {
Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
error: missing fragment specifier
22
--> $DIR/macro-missing-fragment-deduplication.rs:4:6
33
|
4-
LL | ($name) => {}
4+
LL | ($name) => {};
55
| ^^^^^
6-
7-
error: missing fragment specifier
8-
--> $DIR/macro-missing-fragment-deduplication.rs:4:6
96
|
10-
LL | ($name) => {}
11-
| ^^^^^
7+
= note: fragment specifiers must be specified in the 2024 edition
8+
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `expr_2021`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
9+
help: try adding a specifier here
1210
|
13-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
15-
= note: `#[deny(missing_fragment_specifier)]` on by default
11+
LL | ($name:spec) => {};
12+
| +++++
1613

17-
error: aborting due to 2 previous errors
18-
19-
Future incompatibility report: Future breakage diagnostic:
2014
error: missing fragment specifier
2115
--> $DIR/macro-missing-fragment-deduplication.rs:4:6
2216
|
23-
LL | ($name) => {}
17+
LL | ($name) => {};
2418
| ^^^^^
25-
|
26-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
28-
= note: `#[deny(missing_fragment_specifier)]` on by default
19+
20+
error: aborting due to 2 previous errors
2921

‎tests/ui/macros/macro-missing-fragment.e2015.stderr

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎tests/ui/macros/macro-missing-fragment.rs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
1-
//@ revisions: e2015 e2024
2-
//@[e2015] edition:2015
3-
//@[e2024] edition:2024
4-
//@[e2024] compile-flags: -Zunstable-options
5-
6-
#![warn(missing_fragment_specifier)]
7-
81
macro_rules! used_arm {
9-
( $( any_token $field_rust_type )* ) => {};
10-
//[e2015]~^ ERROR missing fragment
11-
//[e2015]~| WARN missing fragment
12-
//[e2015]~| WARN this was previously accepted
13-
//[e2024]~^^^^ ERROR missing fragment
14-
//[e2024]~| ERROR missing fragment
2+
( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment
3+
//~| ERROR missing fragment
154
}
165

176
macro_rules! used_macro_unused_arm {
187
() => {};
19-
( $name ) => {};
20-
//[e2015]~^ WARN missing fragment
21-
//[e2015]~| WARN this was previously accepted
22-
//[e2024]~^^^ ERROR missing fragment
8+
( $name ) => {}; //~ ERROR missing fragment
239
}
2410

2511
macro_rules! unused_macro {
26-
( $name ) => {};
27-
//[e2015]~^ WARN missing fragment
28-
//[e2015]~| WARN this was previously accepted
29-
//[e2024]~^^^ ERROR missing fragment
12+
( $name ) => {}; //~ ERROR missing fragment
3013
}
3114

3215
fn main() {

‎tests/ui/macros/macro-missing-fragment.e2024.stderr renamed to ‎tests/ui/macros/macro-missing-fragment.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: missing fragment specifier
2-
--> $DIR/macro-missing-fragment.rs:9:20
2+
--> $DIR/macro-missing-fragment.rs:2:20
33
|
44
LL | ( $( any_token $field_rust_type )* ) => {};
55
| ^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | ( $( any_token $field_rust_type:spec )* ) => {};
1212
| +++++
1313

1414
error: missing fragment specifier
15-
--> $DIR/macro-missing-fragment.rs:19:7
15+
--> $DIR/macro-missing-fragment.rs:8:7
1616
|
1717
LL | ( $name ) => {};
1818
| ^^^^^
@@ -25,7 +25,7 @@ LL | ( $name:spec ) => {};
2525
| +++++
2626

2727
error: missing fragment specifier
28-
--> $DIR/macro-missing-fragment.rs:26:7
28+
--> $DIR/macro-missing-fragment.rs:12:7
2929
|
3030
LL | ( $name ) => {};
3131
| ^^^^^
@@ -38,7 +38,7 @@ LL | ( $name:spec ) => {};
3838
| +++++
3939

4040
error: missing fragment specifier
41-
--> $DIR/macro-missing-fragment.rs:9:20
41+
--> $DIR/macro-missing-fragment.rs:2:20
4242
|
4343
LL | ( $( any_token $field_rust_type )* ) => {};
4444
| ^^^^^^^^^^^^^^^^

‎tests/ui/parser/macro/issue-33569.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ macro_rules! foo {
22
{ $+ } => { //~ ERROR expected identifier, found `+`
33
//~^ ERROR missing fragment specifier
44
//~| ERROR missing fragment specifier
5-
//~| WARN this was previously accepted
65
$(x)(y) //~ ERROR expected one of: `*`, `+`, or `?`
76
}
87
}

‎tests/ui/parser/macro/issue-33569.stderr

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | { $+ } => {
55
| ^
66

77
error: expected one of: `*`, `+`, or `?`
8-
--> $DIR/issue-33569.rs:6:13
8+
--> $DIR/issue-33569.rs:5:13
99
|
1010
LL | $(x)(y)
1111
| ^^^
@@ -15,27 +15,19 @@ error: missing fragment specifier
1515
|
1616
LL | { $+ } => {
1717
| ^
18-
19-
error: missing fragment specifier
20-
--> $DIR/issue-33569.rs:2:8
2118
|
22-
LL | { $+ } => {
23-
| ^
19+
= note: fragment specifiers must be specified in the 2024 edition
20+
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `expr_2021`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
21+
help: try adding a specifier here
2422
|
25-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
26-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
27-
= note: `#[deny(missing_fragment_specifier)]` on by default
23+
LL | { $+:spec } => {
24+
| +++++
2825

29-
error: aborting due to 4 previous errors
30-
31-
Future incompatibility report: Future breakage diagnostic:
3226
error: missing fragment specifier
3327
--> $DIR/issue-33569.rs:2:8
3428
|
3529
LL | { $+ } => {
3630
| ^
37-
|
38-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
39-
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
40-
= note: `#[deny(missing_fragment_specifier)]` on by default
31+
32+
error: aborting due to 4 previous errors
4133

0 commit comments

Comments
 (0)
This repository has been archived.