From df71a99a0ea8d89cb1ec9281a6a24a8710c37c9d Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Tue, 29 Jun 2021 16:05:32 +0200 Subject: [PATCH] Rename lint --- compiler/rustc_lint/src/lib.rs | 1 + .../2229_closure_analysis/migrations/old_name.rs | 9 +++++++++ .../2229_closure_analysis/migrations/old_name.stderr | 10 ++++++++++ 3 files changed, 20 insertions(+) create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/old_name.rs create mode 100644 src/test/ui/closures/2229_closure_analysis/migrations/old_name.stderr diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 89f9809d643..b3b759a466a 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -325,6 +325,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) { store.register_renamed("redundant_semicolon", "redundant_semicolons"); 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"); // 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 diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/old_name.rs b/src/test/ui/closures/2229_closure_analysis/migrations/old_name.rs new file mode 100644 index 00000000000..16e3cca7b77 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/old_name.rs @@ -0,0 +1,9 @@ +// check-pass + +// Ensure that the old name for `rust_2021_incompatible_closure_captures` is still +// accepted by the compiler + +#![allow(disjoint_capture_migration)] +//~^ WARN lint `disjoint_capture_migration` has been renamed + +fn main() {} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/old_name.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/old_name.stderr new file mode 100644 index 00000000000..47cb689fa01 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/old_name.stderr @@ -0,0 +1,10 @@ +warning: lint `disjoint_capture_migration` has been renamed to `rust_2021_incompatible_closure_captures` + --> $DIR/old_name.rs:6:10 + | +LL | #![allow(disjoint_capture_migration)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rust_2021_incompatible_closure_captures` + | + = note: `#[warn(renamed_and_removed_lints)]` on by default + +warning: 1 warning emitted +