mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
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
This commit is contained in:
@@ -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}
|
||||
|
||||
|
||||
@@ -112,9 +112,8 @@
|
||||
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");
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -619,6 +619,11 @@ macro_rules! add_lint_group {
|
||||
"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) {
|
||||
|
||||
@@ -2616,10 +2616,6 @@ fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
|
||||
#[diag(lint_cfg_attr_no_attributes)]
|
||||
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 {
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
MACRO_USE_EXTERN_CRATE,
|
||||
META_VARIABLE_MISUSE,
|
||||
MISSING_ABI,
|
||||
MISSING_FRAGMENT_SPECIFIER,
|
||||
MISSING_UNSAFE_ON_EXTERN,
|
||||
MUST_NOT_SUSPEND,
|
||||
NAMED_ARGUMENTS_USED_POSITIONALLY,
|
||||
@@ -1417,51 +1416,6 @@
|
||||
};
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
@@ -778,7 +778,6 @@ pub enum BuiltinLintDiag {
|
||||
UnnameableTestItems,
|
||||
DuplicateMacroAttribute,
|
||||
CfgAttrNoAttributes,
|
||||
MissingFragmentSpecifier,
|
||||
MetaVariableStillRepeating(MacroRulesNormalizedIdent),
|
||||
MetaVariableWrongOperator,
|
||||
DuplicateMatcherBinding,
|
||||
|
||||
@@ -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 {
|
||||
() => {}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
error: missing fragment specifier
|
||||
--> $DIR/macro-match-nonterminal.rs:2:6
|
||||
|
|
||||
LL | ($a, $b) => {
|
||||
| ^^
|
||||
|
||||
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
|
||||
= 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: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>
|
||||
= 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) => {
|
||||
| +++++
|
||||
|
||||
error: missing fragment specifier
|
||||
--> $DIR/macro-match-nonterminal.rs:2:6
|
||||
|
|
||||
LL | ($a, $b) => {
|
||||
| ^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
error: missing fragment specifier
|
||||
--> $DIR/macro-missing-fragment-deduplication.rs:4:6
|
||||
|
|
||||
LL | ($name) => {}
|
||||
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
|
||||
|
|
||||
LL | ($name:spec) => {};
|
||||
| +++++
|
||||
|
||||
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
|
||||
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
error: missing fragment specifier
|
||||
--> $DIR/macro-missing-fragment-deduplication.rs:4:6
|
||||
|
|
||||
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
|
||||
|
||||
|
||||
@@ -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)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -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() {
|
||||
|
||||
+7
-7
@@ -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 )* ) => {};
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
@@ -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 `?`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 | { $+ } => {
|
||||
| ^
|
||||
|
|
||||
= 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 | { $+:spec } => {
|
||||
| +++++
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user