Skip to content

Commit 1d49658

Browse files
committed
Change or_patterns_back_compat lint to rust_2021_incompatible_or_patterns
1 parent df71a99 commit 1d49658

File tree

7 files changed

+14
-10
lines changed

7 files changed

+14
-10
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use rustc_data_structures::fx::FxHashMap;
1818
use rustc_data_structures::sync::Lrc;
1919
use rustc_errors::{Applicability, DiagnosticBuilder};
2020
use rustc_feature::Features;
21-
use rustc_lint_defs::builtin::{OR_PATTERNS_BACK_COMPAT, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS};
21+
use rustc_lint_defs::builtin::{
22+
RUST_2021_INCOMPATIBLE_OR_PATTERNS, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
23+
};
2224
use rustc_lint_defs::BuiltinLintDiagnostics;
2325
use rustc_parse::parser::Parser;
2426
use rustc_session::parse::ParseSess;
@@ -975,7 +977,7 @@ fn check_matcher_core(
975977
Some(NonterminalKind::PatParam { inferred: false }),
976978
));
977979
sess.buffer_lint_with_diagnostic(
978-
&OR_PATTERNS_BACK_COMPAT,
980+
&RUST_2021_INCOMPATIBLE_OR_PATTERNS,
979981
span,
980982
ast::CRATE_NODE_ID,
981983
"the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro",

compiler/rustc_lint/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
326326
store.register_renamed("overlapping_patterns", "overlapping_range_endpoints");
327327
store.register_renamed("safe_packed_borrows", "unaligned_references");
328328
store.register_renamed("disjoint_capture_migration", "rust_2021_incompatible_closure_captures");
329+
store.register_renamed("or_patterns_back_compat", "rust_2021_incompatible_or_patterns");
329330

330331
// These were moved to tool lints, but rustc still sees them when compiling normally, before
331332
// tool lints are registered, so `check_tool_name_for_backwards_compat` doesn't work. Use

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,7 @@ declare_lint_pass! {
29702970
RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
29712971
LEGACY_DERIVE_HELPERS,
29722972
PROC_MACRO_BACK_COMPAT,
2973-
OR_PATTERNS_BACK_COMPAT,
2973+
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
29742974
LARGE_ASSIGNMENTS,
29752975
FUTURE_PRELUDE_COLLISION,
29762976
RESERVED_PREFIX,
@@ -3183,12 +3183,12 @@ declare_lint! {
31833183
}
31843184

31853185
declare_lint! {
3186-
/// The `or_patterns_back_compat` lint detects usage of old versions of or-patterns.
3186+
/// The `rust_2021_incompatible_or_patterns` lint detects usage of old versions of or-patterns.
31873187
///
31883188
/// ### Example
31893189
///
31903190
/// ```rust,compile_fail
3191-
/// #![deny(or_patterns_back_compat)]
3191+
/// #![deny(rust_2021_incompatible_or_patterns)]
31923192
/// macro_rules! match_any {
31933193
/// ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
31943194
/// match $expr {
@@ -3211,7 +3211,7 @@ declare_lint! {
32113211
/// ### Explanation
32123212
///
32133213
/// In Rust 2021, the pat matcher will match new patterns, which include the | character.
3214-
pub OR_PATTERNS_BACK_COMPAT,
3214+
pub RUST_2021_INCOMPATIBLE_OR_PATTERNS,
32153215
Allow,
32163216
"detects usage of old versions of or-patterns",
32173217
@future_incompatible = FutureIncompatibleInfo {

library/core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
#![feature(no_niche)] // rust-lang/rust#68303
165165
#![feature(no_coverage)] // rust-lang/rust#84605
166166
#![deny(unsafe_op_in_unsafe_fn)]
167+
#![allow(renamed_and_removed_lints)]
167168
#![deny(or_patterns_back_compat)]
168169

169170
// allow using `core::` in intra-doc links

src/test/ui/macros/macro-or-patterns-back-compat.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-rustfix
22
// aux-build:or-pattern.rs
33

4-
#![deny(or_patterns_back_compat)]
4+
#![deny(rust_2021_incompatible_or_patterns)]
55
#![allow(unused_macros)]
66

77
#[macro_use]

src/test/ui/macros/macro-or-patterns-back-compat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-rustfix
22
// aux-build:or-pattern.rs
33

4-
#![deny(or_patterns_back_compat)]
4+
#![deny(rust_2021_incompatible_or_patterns)]
55
#![allow(unused_macros)]
66

77
#[macro_use]

src/test/ui/macros/macro-or-patterns-back-compat.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
77
note: the lint level is defined here
88
--> $DIR/macro-or-patterns-back-compat.rs:4:9
99
|
10-
LL | #![deny(or_patterns_back_compat)]
11-
| ^^^^^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(rust_2021_incompatible_or_patterns)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
1313
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>
1414

0 commit comments

Comments
 (0)