Change or_patterns_back_compat lint to rust_2021_incompatible_or_patterns
This commit is contained in:
parent
df71a99a0e
commit
1d49658f5c
@ -18,7 +18,9 @@ use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder};
|
||||
use rustc_feature::Features;
|
||||
use rustc_lint_defs::builtin::{OR_PATTERNS_BACK_COMPAT, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS};
|
||||
use rustc_lint_defs::builtin::{
|
||||
RUST_2021_INCOMPATIBLE_OR_PATTERNS, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
|
||||
};
|
||||
use rustc_lint_defs::BuiltinLintDiagnostics;
|
||||
use rustc_parse::parser::Parser;
|
||||
use rustc_session::parse::ParseSess;
|
||||
@ -975,7 +977,7 @@ fn check_matcher_core(
|
||||
Some(NonterminalKind::PatParam { inferred: false }),
|
||||
));
|
||||
sess.buffer_lint_with_diagnostic(
|
||||
&OR_PATTERNS_BACK_COMPAT,
|
||||
&RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
||||
span,
|
||||
ast::CRATE_NODE_ID,
|
||||
"the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro",
|
||||
|
@ -326,6 +326,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
|
||||
store.register_renamed("overlapping_patterns", "overlapping_range_endpoints");
|
||||
store.register_renamed("safe_packed_borrows", "unaligned_references");
|
||||
store.register_renamed("disjoint_capture_migration", "rust_2021_incompatible_closure_captures");
|
||||
store.register_renamed("or_patterns_back_compat", "rust_2021_incompatible_or_patterns");
|
||||
|
||||
// These were moved to tool lints, but rustc still sees them when compiling normally, before
|
||||
// tool lints are registered, so `check_tool_name_for_backwards_compat` doesn't work. Use
|
||||
|
@ -2970,7 +2970,7 @@ declare_lint_pass! {
|
||||
RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
|
||||
LEGACY_DERIVE_HELPERS,
|
||||
PROC_MACRO_BACK_COMPAT,
|
||||
OR_PATTERNS_BACK_COMPAT,
|
||||
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
||||
LARGE_ASSIGNMENTS,
|
||||
FUTURE_PRELUDE_COLLISION,
|
||||
RESERVED_PREFIX,
|
||||
@ -3183,12 +3183,12 @@ declare_lint! {
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
/// The `or_patterns_back_compat` lint detects usage of old versions of or-patterns.
|
||||
/// The `rust_2021_incompatible_or_patterns` lint detects usage of old versions of or-patterns.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// #![deny(or_patterns_back_compat)]
|
||||
/// #![deny(rust_2021_incompatible_or_patterns)]
|
||||
/// macro_rules! match_any {
|
||||
/// ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
|
||||
/// match $expr {
|
||||
@ -3211,7 +3211,7 @@ declare_lint! {
|
||||
/// ### Explanation
|
||||
///
|
||||
/// In Rust 2021, the pat matcher will match new patterns, which include the | character.
|
||||
pub OR_PATTERNS_BACK_COMPAT,
|
||||
pub RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
||||
Allow,
|
||||
"detects usage of old versions of or-patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
|
@ -164,6 +164,7 @@
|
||||
#![feature(no_niche)] // rust-lang/rust#68303
|
||||
#![feature(no_coverage)] // rust-lang/rust#84605
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
#![allow(renamed_and_removed_lints)]
|
||||
#![deny(or_patterns_back_compat)]
|
||||
|
||||
// allow using `core::` in intra-doc links
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
// aux-build:or-pattern.rs
|
||||
|
||||
#![deny(or_patterns_back_compat)]
|
||||
#![deny(rust_2021_incompatible_or_patterns)]
|
||||
#![allow(unused_macros)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -1,7 +1,7 @@
|
||||
// run-rustfix
|
||||
// aux-build:or-pattern.rs
|
||||
|
||||
#![deny(or_patterns_back_compat)]
|
||||
#![deny(rust_2021_incompatible_or_patterns)]
|
||||
#![allow(unused_macros)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -7,8 +7,8 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
|
||||
note: the lint level is defined here
|
||||
--> $DIR/macro-or-patterns-back-compat.rs:4:9
|
||||
|
|
||||
LL | #![deny(or_patterns_back_compat)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(rust_2021_incompatible_or_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user