From 1c7ab18c08109753b795bff83dd838ac8e4cdb70 Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 19 May 2023 11:14:55 +0200 Subject: [PATCH 1/4] Rename `drop_copy` lint to `dropping_copy_types` --- compiler/rustc_lint/messages.ftl | 2 +- .../rustc_lint/src/drop_forget_useless.rs | 8 +++--- compiler/rustc_lint/src/lints.rs | 2 +- library/core/src/mem/mod.rs | 2 +- .../clippy_lints/src/drop_forget_ref.rs | 2 +- .../clippy/clippy_lints/src/renamed_lints.rs | 2 +- .../tests/ui/multiple_unsafe_ops_per_block.rs | 2 +- src/tools/clippy/tests/ui/rename.fixed | 4 +-- src/tools/clippy/tests/ui/rename.rs | 2 +- src/tools/clippy/tests/ui/rename.stderr | 4 +-- src/tools/miri/tests/fail/uninit_buffer.rs | 2 +- .../fail/uninit_buffer_with_provenance.rs | 2 +- .../zst-field-retagging-terminates.rs | 2 +- .../ui/associated-inherent-types/inference.rs | 2 +- .../borrowck-field-sensitivity-rpass.rs | 2 +- .../borrowck/borrowck-use-mut-borrow-rpass.rs | 2 +- .../migrations/issue-78720.rs | 2 +- tests/ui/crate-leading-sep.rs | 2 +- tests/ui/drop/repeat-drop.rs | 2 +- tests/ui/generator/drop-env.rs | 2 +- tests/ui/generator/issue-57017.rs | 2 +- tests/ui/generator/non-static-is-unpin.rs | 2 +- tests/ui/generator/resume-arg-size.rs | 2 +- .../stdlib-prelude-from-opaque-late.rs | 2 +- .../{drop_copy.rs => dropping_copy_types.rs} | 2 +- ...copy.stderr => dropping_copy_types.stderr} | 26 +++++++++---------- tests/ui/liveness/liveness-unused.rs | 2 +- .../ui/macros/parse-complex-macro-invoc-op.rs | 2 +- tests/ui/never_type/never-assign-dead-code.rs | 2 +- tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs | 2 +- .../or-patterns-default-binding-modes.rs | 2 +- .../borrowck-pat-at-and-box-pass.rs | 2 +- .../borrowck-pat-by-copy-bindings-in-at.rs | 2 +- tests/ui/print_type_sizes/async.rs | 2 +- .../generator_discr_placement.rs | 2 +- ...type-param-outlives-reempty-issue-74429.rs | 2 +- .../dbg-macro-expected-behavior.rs | 2 +- tests/ui/rust-2018/remove-extern-crate.fixed | 2 +- tests/ui/rust-2018/remove-extern-crate.rs | 2 +- tests/ui/statics/issue-91050-1.rs | 2 +- tests/ui/traits/copy-guessing.rs | 2 +- tests/ui/traits/impl-evaluation-order.rs | 2 +- .../trivial-bounds-inconsistent-copy.rs | 2 +- 43 files changed, 60 insertions(+), 60 deletions(-) rename tests/ui/lint/{drop_copy.rs => dropping_copy_types.rs} (98%) rename tests/ui/lint/{drop_copy.stderr => dropping_copy_types.stderr} (85%) diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index a5639404fafd4..169c1fbe2acaf 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -525,7 +525,7 @@ lint_drop_ref = calls to `std::mem::drop` with a reference instead of an owned v .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result -lint_drop_copy = calls to `std::mem::drop` with a value that implements `Copy` does nothing +lint_dropping_copy_types = calls to `std::mem::drop` with a value that implements `Copy` does nothing .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result diff --git a/compiler/rustc_lint/src/drop_forget_useless.rs b/compiler/rustc_lint/src/drop_forget_useless.rs index 259abc2af1129..e61adc61e5ecf 100644 --- a/compiler/rustc_lint/src/drop_forget_useless.rs +++ b/compiler/rustc_lint/src/drop_forget_useless.rs @@ -58,7 +58,7 @@ declare_lint! { } declare_lint! { - /// The `drop_copy` lint checks for calls to `std::mem::drop` with a value + /// The `dropping_copy_types` lint checks for calls to `std::mem::drop` with a value /// that derives the Copy trait. /// /// ### Example @@ -76,7 +76,7 @@ declare_lint! { /// Calling `std::mem::drop` [does nothing for types that /// implement Copy](https://doc.rust-lang.org/std/mem/fn.drop.html), since the /// value will be copied and moved into the function on invocation. - pub DROP_COPY, + pub DROPPING_COPY_TYPES, Warn, "calls to `std::mem::drop` with a value that implements Copy" } @@ -109,7 +109,7 @@ declare_lint! { "calls to `std::mem::forget` with a value that implements Copy" } -declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROP_COPY, FORGET_COPY]); +declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGET_COPY]); impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { @@ -129,7 +129,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span }); }, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => { - cx.emit_spanned_lint(DROP_COPY, expr.span, DropCopyDiag { arg_ty, label: arg.span }); + cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span }); } sym::mem_forget if is_copy => { cx.emit_spanned_lint(FORGET_COPY, expr.span, ForgetCopyDiag { arg_ty, label: arg.span }); diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 8e48806b50447..278c0bc32e955 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -673,7 +673,7 @@ pub struct DropRefDiag<'a> { } #[derive(LintDiagnostic)] -#[diag(lint_drop_copy)] +#[diag(lint_dropping_copy_types)] #[note] pub struct DropCopyDiag<'a> { pub arg_ty: Ty<'a>, diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 289305253ecc1..afbfd6d362dc9 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -968,7 +968,7 @@ pub const fn replace(dest: &mut T, src: T) -> T { /// Integers and other types implementing [`Copy`] are unaffected by `drop`. /// /// ``` -/// # #![cfg_attr(not(bootstrap), allow(drop_copy))] +/// # #![cfg_attr(not(bootstrap), allow(dropping_copy_types))] /// #[derive(Copy, Clone)] /// struct Foo(u8); /// diff --git a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs index b2f7d026cc8b2..9a7b39e1544eb 100644 --- a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs +++ b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs @@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef { let is_copy = is_copy(cx, arg_ty); let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); let (lint, msg) = match fn_name { - // early return for uplifted lints: drop_ref, drop_copy, forget_ref, forget_copy + // early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forget_copy sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return, sym::mem_forget if arg_ty.is_ref() => return, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return, diff --git a/src/tools/clippy/clippy_lints/src/renamed_lints.rs b/src/tools/clippy/clippy_lints/src/renamed_lints.rs index a2c3465cde4a3..308e40abf6a25 100644 --- a/src/tools/clippy/clippy_lints/src/renamed_lints.rs +++ b/src/tools/clippy/clippy_lints/src/renamed_lints.rs @@ -33,7 +33,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[ ("clippy::zero_width_space", "clippy::invisible_characters"), ("clippy::clone_double_ref", "suspicious_double_ref_op"), ("clippy::drop_bounds", "drop_bounds"), - ("clippy::drop_copy", "drop_copy"), + ("clippy::drop_copy", "dropping_copy_types"), ("clippy::drop_ref", "drop_ref"), ("clippy::for_loop_over_option", "for_loops_over_fallibles"), ("clippy::for_loop_over_result", "for_loops_over_fallibles"), diff --git a/src/tools/clippy/tests/ui/multiple_unsafe_ops_per_block.rs b/src/tools/clippy/tests/ui/multiple_unsafe_ops_per_block.rs index f28153e56b0fe..4ef6f0ca92f2d 100644 --- a/src/tools/clippy/tests/ui/multiple_unsafe_ops_per_block.rs +++ b/src/tools/clippy/tests/ui/multiple_unsafe_ops_per_block.rs @@ -2,7 +2,7 @@ #![allow(unused)] #![allow(deref_nullptr)] #![allow(clippy::unnecessary_operation)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #![warn(clippy::multiple_unsafe_ops_per_block)] extern crate proc_macros; diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index 7c2acf43fe836..8633e422805a6 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -30,7 +30,7 @@ #![allow(clippy::invisible_characters)] #![allow(suspicious_double_ref_op)] #![allow(drop_bounds)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #![allow(drop_ref)] #![allow(for_loops_over_fallibles)] #![allow(forget_copy)] @@ -77,7 +77,7 @@ #![warn(clippy::invisible_characters)] #![warn(suspicious_double_ref_op)] #![warn(drop_bounds)] -#![warn(drop_copy)] +#![warn(dropping_copy_types)] #![warn(drop_ref)] #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index 8d334b0d0501a..07b33b4da95b3 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -30,7 +30,7 @@ #![allow(clippy::invisible_characters)] #![allow(suspicious_double_ref_op)] #![allow(drop_bounds)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #![allow(drop_ref)] #![allow(for_loops_over_fallibles)] #![allow(forget_copy)] diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index fbf8d3d7e4e8b..20e7d96b7209b 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -186,11 +186,11 @@ error: lint `clippy::drop_bounds` has been renamed to `drop_bounds` LL | #![warn(clippy::drop_bounds)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds` -error: lint `clippy::drop_copy` has been renamed to `drop_copy` +error: lint `clippy::drop_copy` has been renamed to `dropping_copy_types` --> $DIR/rename.rs:80:9 | LL | #![warn(clippy::drop_copy)] - | ^^^^^^^^^^^^^^^^^ help: use the new name: `drop_copy` + | ^^^^^^^^^^^^^^^^^ help: use the new name: `dropping_copy_types` error: lint `clippy::drop_ref` has been renamed to `drop_ref` --> $DIR/rename.rs:81:9 diff --git a/src/tools/miri/tests/fail/uninit_buffer.rs b/src/tools/miri/tests/fail/uninit_buffer.rs index 8a33005837528..d622b2fa7d812 100644 --- a/src/tools/miri/tests/fail/uninit_buffer.rs +++ b/src/tools/miri/tests/fail/uninit_buffer.rs @@ -1,6 +1,6 @@ //@error-in-other-file: memory is uninitialized at [0x4..0x10] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] use std::alloc::{alloc, dealloc, Layout}; use std::slice::from_raw_parts; diff --git a/src/tools/miri/tests/fail/uninit_buffer_with_provenance.rs b/src/tools/miri/tests/fail/uninit_buffer_with_provenance.rs index 443f481c0874a..ca825901372c5 100644 --- a/src/tools/miri/tests/fail/uninit_buffer_with_provenance.rs +++ b/src/tools/miri/tests/fail/uninit_buffer_with_provenance.rs @@ -1,7 +1,7 @@ //@error-in-other-file: memory is uninitialized at [0x4..0x8] //@normalize-stderr-test: "a[0-9]+" -> "ALLOC" #![feature(strict_provenance)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] // Test printing allocations that contain single-byte provenance. diff --git a/src/tools/miri/tests/pass/stacked-borrows/zst-field-retagging-terminates.rs b/src/tools/miri/tests/pass/stacked-borrows/zst-field-retagging-terminates.rs index 9f743f0b56656..6e13a9ea8369b 100644 --- a/src/tools/miri/tests/pass/stacked-borrows/zst-field-retagging-terminates.rs +++ b/src/tools/miri/tests/pass/stacked-borrows/zst-field-retagging-terminates.rs @@ -1,7 +1,7 @@ //@compile-flags: -Zmiri-retag-fields // Checks that the test does not run forever (which relies on a fast path). -#![allow(drop_copy)] +#![allow(dropping_copy_types)] fn main() { let array = [(); usize::MAX]; diff --git a/tests/ui/associated-inherent-types/inference.rs b/tests/ui/associated-inherent-types/inference.rs index 7d6d26003f60e..ebd8e1d55945f 100644 --- a/tests/ui/associated-inherent-types/inference.rs +++ b/tests/ui/associated-inherent-types/inference.rs @@ -3,7 +3,7 @@ #![feature(inherent_associated_types)] #![allow(incomplete_features)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] use std::convert::identity; diff --git a/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs b/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs index a88b323e0bf1e..78e965cc4bc7b 100644 --- a/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs +++ b/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_mut)] #![allow(unused_variables)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] // pretty-expanded FIXME #23616 struct A { a: isize, b: Box } diff --git a/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs b/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs index 40c6bfeeb434b..9acb1ec5e43a6 100644 --- a/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs +++ b/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs @@ -1,7 +1,7 @@ // run-pass // pretty-expanded FIXME #23616 -#![allow(drop_copy)] +#![allow(dropping_copy_types)] struct A { a: isize, b: Box } diff --git a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs index bc7295a0826f1..5e4c19ff38b20 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs +++ b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs @@ -1,7 +1,7 @@ // run-pass #![warn(rust_2021_incompatible_closure_captures)] -#![allow(drop_ref, drop_copy)] +#![allow(drop_ref, dropping_copy_types)] fn main() { if let a = "" { diff --git a/tests/ui/crate-leading-sep.rs b/tests/ui/crate-leading-sep.rs index 8d1d0b4fcdf02..fce97d9ba2370 100644 --- a/tests/ui/crate-leading-sep.rs +++ b/tests/ui/crate-leading-sep.rs @@ -1,7 +1,7 @@ // run-pass // pretty-expanded FIXME #23616 -#![allow(drop_copy)] +#![allow(dropping_copy_types)] fn main() { use ::std::mem; diff --git a/tests/ui/drop/repeat-drop.rs b/tests/ui/drop/repeat-drop.rs index 659d35db6575a..a52900311ea65 100644 --- a/tests/ui/drop/repeat-drop.rs +++ b/tests/ui/drop/repeat-drop.rs @@ -1,7 +1,7 @@ // run-pass // needs-unwind -#![allow(drop_ref, drop_copy)] +#![allow(drop_ref, dropping_copy_types)] static mut CHECK: usize = 0; diff --git a/tests/ui/generator/drop-env.rs b/tests/ui/generator/drop-env.rs index cb46953dac3c8..137a407931a17 100644 --- a/tests/ui/generator/drop-env.rs +++ b/tests/ui/generator/drop-env.rs @@ -4,7 +4,7 @@ //[nomiropt]compile-flags: -Z mir-opt-level=0 #![feature(generators, generator_trait)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] use std::ops::Generator; use std::pin::Pin; diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs index 918d233bf4ee6..aac6e591e688c 100644 --- a/tests/ui/generator/issue-57017.rs +++ b/tests/ui/generator/issue-57017.rs @@ -5,7 +5,7 @@ // [drop_tracking_mir] build-pass #![feature(generators, negative_impls)] -#![allow(drop_ref, drop_copy)] +#![allow(drop_ref, dropping_copy_types)] macro_rules! type_combinations { ( diff --git a/tests/ui/generator/non-static-is-unpin.rs b/tests/ui/generator/non-static-is-unpin.rs index adba800e25aeb..a5dde3912cc00 100644 --- a/tests/ui/generator/non-static-is-unpin.rs +++ b/tests/ui/generator/non-static-is-unpin.rs @@ -3,7 +3,7 @@ // run-pass #![feature(generators, generator_trait)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] use std::marker::{PhantomPinned, Unpin}; diff --git a/tests/ui/generator/resume-arg-size.rs b/tests/ui/generator/resume-arg-size.rs index 19618f8d0aa55..195166f975b63 100644 --- a/tests/ui/generator/resume-arg-size.rs +++ b/tests/ui/generator/resume-arg-size.rs @@ -1,5 +1,5 @@ #![feature(generators)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] // run-pass diff --git a/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs b/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs index 214267372bf87..721bb7281c0ff 100644 --- a/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs +++ b/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs @@ -1,7 +1,7 @@ // check-pass #![feature(decl_macro)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] macro mac() { mod m { diff --git a/tests/ui/lint/drop_copy.rs b/tests/ui/lint/dropping_copy_types.rs similarity index 98% rename from tests/ui/lint/drop_copy.rs rename to tests/ui/lint/dropping_copy_types.rs index 0adcd34505f0b..2937320e5d833 100644 --- a/tests/ui/lint/drop_copy.rs +++ b/tests/ui/lint/dropping_copy_types.rs @@ -1,6 +1,6 @@ // check-pass -#![warn(drop_copy)] +#![warn(dropping_copy_types)] use std::mem::drop; use std::vec::Vec; diff --git a/tests/ui/lint/drop_copy.stderr b/tests/ui/lint/dropping_copy_types.stderr similarity index 85% rename from tests/ui/lint/drop_copy.stderr rename to tests/ui/lint/dropping_copy_types.stderr index db8e89ad295b9..dc5c6211e7112 100644 --- a/tests/ui/lint/drop_copy.stderr +++ b/tests/ui/lint/dropping_copy_types.stderr @@ -1,5 +1,5 @@ warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/drop_copy.rs:34:5 + --> $DIR/dropping_copy_types.rs:34:5 | LL | drop(s1); | ^^^^^--^ @@ -8,13 +8,13 @@ LL | drop(s1); | = note: use `let _ = ...` to ignore the expression or result note: the lint level is defined here - --> $DIR/drop_copy.rs:3:9 + --> $DIR/dropping_copy_types.rs:3:9 | -LL | #![warn(drop_copy)] - | ^^^^^^^^^ +LL | #![warn(dropping_copy_types)] + | ^^^^^^^^^^^^^^^^^^^ warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/drop_copy.rs:35:5 + --> $DIR/dropping_copy_types.rs:35:5 | LL | drop(s2); | ^^^^^--^ @@ -24,7 +24,7 @@ LL | drop(s2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_copy.rs:36:5 + --> $DIR/dropping_copy_types.rs:36:5 | LL | drop(s3); | ^^^^^--^ @@ -35,7 +35,7 @@ LL | drop(s3); = note: `#[warn(drop_ref)]` on by default warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/drop_copy.rs:37:5 + --> $DIR/dropping_copy_types.rs:37:5 | LL | drop(s4); | ^^^^^--^ @@ -45,7 +45,7 @@ LL | drop(s4); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_copy.rs:38:5 + --> $DIR/dropping_copy_types.rs:38:5 | LL | drop(s5); | ^^^^^--^ @@ -55,7 +55,7 @@ LL | drop(s5); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_copy.rs:50:5 + --> $DIR/dropping_copy_types.rs:50:5 | LL | drop(a2); | ^^^^^--^ @@ -65,7 +65,7 @@ LL | drop(a2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_copy.rs:52:5 + --> $DIR/dropping_copy_types.rs:52:5 | LL | drop(a4); | ^^^^^--^ @@ -75,7 +75,7 @@ LL | drop(a4); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/drop_copy.rs:71:13 + --> $DIR/dropping_copy_types.rs:71:13 | LL | drop(println_and(13)); | ^^^^^---------------^ @@ -85,7 +85,7 @@ LL | drop(println_and(13)); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/drop_copy.rs:74:14 + --> $DIR/dropping_copy_types.rs:74:14 | LL | 3 if drop(println_and(14)) == () => (), | ^^^^^---------------^ @@ -95,7 +95,7 @@ LL | 3 if drop(println_and(14)) == () => (), = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/drop_copy.rs:76:14 + --> $DIR/dropping_copy_types.rs:76:14 | LL | 4 => drop(2), | ^^^^^-^ diff --git a/tests/ui/liveness/liveness-unused.rs b/tests/ui/liveness/liveness-unused.rs index 8ef6ab1b6ff45..ba635e6638c8c 100644 --- a/tests/ui/liveness/liveness-unused.rs +++ b/tests/ui/liveness/liveness-unused.rs @@ -1,7 +1,7 @@ #![warn(unused)] #![deny(unused_variables)] #![deny(unused_assignments)] -#![allow(dead_code, non_camel_case_types, trivial_numeric_casts, drop_copy)] +#![allow(dead_code, non_camel_case_types, trivial_numeric_casts, dropping_copy_types)] use std::ops::AddAssign; diff --git a/tests/ui/macros/parse-complex-macro-invoc-op.rs b/tests/ui/macros/parse-complex-macro-invoc-op.rs index c50dfdf0116a2..10810388d2033 100644 --- a/tests/ui/macros/parse-complex-macro-invoc-op.rs +++ b/tests/ui/macros/parse-complex-macro-invoc-op.rs @@ -4,7 +4,7 @@ #![allow(unused_assignments)] #![allow(unused_variables)] #![allow(stable_features)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] // Test parsing binary operators after macro invocations. diff --git a/tests/ui/never_type/never-assign-dead-code.rs b/tests/ui/never_type/never-assign-dead-code.rs index e95a992d7804c..39df7de5a7fbb 100644 --- a/tests/ui/never_type/never-assign-dead-code.rs +++ b/tests/ui/never_type/never-assign-dead-code.rs @@ -3,7 +3,7 @@ // check-pass #![feature(never_type)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #![warn(unused)] fn main() { diff --git a/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs b/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs index 73ceaeeb87572..2e9eff59386de 100644 --- a/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs +++ b/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs @@ -5,7 +5,7 @@ // check-pass // compile-flags:-Zno-leak-check -#![allow(drop_copy)] +#![allow(dropping_copy_types)] fn make_it() -> for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 { panic!() diff --git a/tests/ui/or-patterns/or-patterns-default-binding-modes.rs b/tests/ui/or-patterns/or-patterns-default-binding-modes.rs index c138d99d30328..398cc0a0ee6e2 100644 --- a/tests/ui/or-patterns/or-patterns-default-binding-modes.rs +++ b/tests/ui/or-patterns/or-patterns-default-binding-modes.rs @@ -3,7 +3,7 @@ // check-pass #![allow(irrefutable_let_patterns)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #![allow(drop_ref)] fn main() { diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs index 965204bf240e3..6184a58b88696 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs @@ -3,7 +3,7 @@ // Test `@` patterns combined with `box` patterns. #![allow(drop_ref)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #![feature(box_patterns)] diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs index 3eb5d2cbf5466..1df51c0edd911 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs @@ -2,7 +2,7 @@ // Test `Copy` bindings in the rhs of `@` patterns. -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #[derive(Copy, Clone)] struct C; diff --git a/tests/ui/print_type_sizes/async.rs b/tests/ui/print_type_sizes/async.rs index c73268dc46a72..f38a6e674da99 100644 --- a/tests/ui/print_type_sizes/async.rs +++ b/tests/ui/print_type_sizes/async.rs @@ -3,7 +3,7 @@ // build-pass // ignore-pass -#![allow(drop_copy)] +#![allow(dropping_copy_types)] async fn wait() {} diff --git a/tests/ui/print_type_sizes/generator_discr_placement.rs b/tests/ui/print_type_sizes/generator_discr_placement.rs index a77a03f0a8ae4..6adc14f9b99e1 100644 --- a/tests/ui/print_type_sizes/generator_discr_placement.rs +++ b/tests/ui/print_type_sizes/generator_discr_placement.rs @@ -6,7 +6,7 @@ // Avoid emitting panic handlers, like the rest of these tests... #![feature(generators)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] pub fn foo() { let a = || { diff --git a/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs b/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs index af2bb09805ac6..0c1e931444162 100644 --- a/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs +++ b/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs @@ -3,7 +3,7 @@ // check-pass -#![allow(drop_copy)] +#![allow(dropping_copy_types)] use std::marker::PhantomData; diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs index 4c1562790d5f4..542be3942b7ee 100644 --- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -4,7 +4,7 @@ // Tests ensuring that `dbg!(expr)` has the expected run-time behavior. // as well as some compile time properties we expect. -#![allow(drop_copy)] +#![allow(dropping_copy_types)] #[derive(Copy, Clone, Debug)] struct Unit; diff --git a/tests/ui/rust-2018/remove-extern-crate.fixed b/tests/ui/rust-2018/remove-extern-crate.fixed index 4ed4d610025fa..209b91af1ddfb 100644 --- a/tests/ui/rust-2018/remove-extern-crate.fixed +++ b/tests/ui/rust-2018/remove-extern-crate.fixed @@ -5,7 +5,7 @@ // compile-flags:--extern remove_extern_crate #![warn(rust_2018_idioms)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] //~ WARNING unused extern crate // Shouldn't suggest changing to `use`, as `another_name` diff --git a/tests/ui/rust-2018/remove-extern-crate.rs b/tests/ui/rust-2018/remove-extern-crate.rs index 5dafdb2b7b774..ef3c2db696af2 100644 --- a/tests/ui/rust-2018/remove-extern-crate.rs +++ b/tests/ui/rust-2018/remove-extern-crate.rs @@ -5,7 +5,7 @@ // compile-flags:--extern remove_extern_crate #![warn(rust_2018_idioms)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] extern crate core; //~ WARNING unused extern crate // Shouldn't suggest changing to `use`, as `another_name` diff --git a/tests/ui/statics/issue-91050-1.rs b/tests/ui/statics/issue-91050-1.rs index f59bcf0b80339..c6268dba567f7 100644 --- a/tests/ui/statics/issue-91050-1.rs +++ b/tests/ui/statics/issue-91050-1.rs @@ -12,7 +12,7 @@ // // In regular builds, the bad cast was UB, like "Invalid LLVMRustVisibility value!" -#![allow(drop_copy)] +#![allow(dropping_copy_types)] pub mod before { #[no_mangle] diff --git a/tests/ui/traits/copy-guessing.rs b/tests/ui/traits/copy-guessing.rs index c1ed4c28a0300..af25010e3bd28 100644 --- a/tests/ui/traits/copy-guessing.rs +++ b/tests/ui/traits/copy-guessing.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -#![allow(drop_copy)] +#![allow(dropping_copy_types)] // "guessing" in trait selection can affect `copy_or_move`. Check that this // is correctly handled. I am not sure what is the "correct" behaviour, diff --git a/tests/ui/traits/impl-evaluation-order.rs b/tests/ui/traits/impl-evaluation-order.rs index 256ce992eefc4..2ce0b6b0df8f0 100644 --- a/tests/ui/traits/impl-evaluation-order.rs +++ b/tests/ui/traits/impl-evaluation-order.rs @@ -6,7 +6,7 @@ // check-pass -#![allow(drop_copy)] +#![allow(dropping_copy_types)] trait A { type B; diff --git a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs index 6ed7667115a0d..7b7f4a4efdb85 100644 --- a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs +++ b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs @@ -2,7 +2,7 @@ // Check tautalogically false `Copy` bounds #![feature(trivial_bounds)] -#![allow(drop_ref, drop_copy)] +#![allow(drop_ref, dropping_copy_types)] fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds is_copy(&t); From 85a18289431d245437d80b3006ec499c23e62400 Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 19 May 2023 11:19:31 +0200 Subject: [PATCH 2/4] Rename `forget_copy` lint to `forgetting_copy_types` --- compiler/rustc_lint/messages.ftl | 2 +- .../rustc_lint/src/drop_forget_useless.rs | 8 +++---- compiler/rustc_lint/src/lints.rs | 2 +- .../clippy_lints/src/drop_forget_ref.rs | 2 +- .../clippy/clippy_lints/src/renamed_lints.rs | 2 +- src/tools/clippy/tests/ui/mem_forget.rs | 2 +- src/tools/clippy/tests/ui/rename.fixed | 4 ++-- src/tools/clippy/tests/ui/rename.rs | 2 +- src/tools/clippy/tests/ui/rename.stderr | 4 ++-- tests/ui/consts/const_forget.rs | 2 +- tests/ui/consts/issue-104155.rs | 2 +- ...orget_copy.rs => forgetting_copy_types.rs} | 2 +- ...py.stderr => forgetting_copy_types.stderr} | 22 +++++++++---------- 13 files changed, 28 insertions(+), 28 deletions(-) rename tests/ui/lint/{forget_copy.rs => forgetting_copy_types.rs} (97%) rename tests/ui/lint/{forget_copy.stderr => forgetting_copy_types.stderr} (83%) diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 169c1fbe2acaf..f60d48e102499 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -533,6 +533,6 @@ lint_forget_ref = calls to `std::mem::forget` with a reference instead of an own .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result -lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy` does nothing +lint_forgetting_copy_types = calls to `std::mem::forget` with a value that implements `Copy` does nothing .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result diff --git a/compiler/rustc_lint/src/drop_forget_useless.rs b/compiler/rustc_lint/src/drop_forget_useless.rs index e61adc61e5ecf..8f3f4914ddea9 100644 --- a/compiler/rustc_lint/src/drop_forget_useless.rs +++ b/compiler/rustc_lint/src/drop_forget_useless.rs @@ -82,7 +82,7 @@ declare_lint! { } declare_lint! { - /// The `forget_copy` lint checks for calls to `std::mem::forget` with a value + /// The `forgetting_copy_types` lint checks for calls to `std::mem::forget` with a value /// that derives the Copy trait. /// /// ### Example @@ -104,12 +104,12 @@ declare_lint! { /// An alternative, but also valid, explanation is that Copy types do not /// implement the Drop trait, which means they have no destructors. Without a /// destructor, there is nothing for `std::mem::forget` to ignore. - pub FORGET_COPY, + pub FORGETTING_COPY_TYPES, Warn, "calls to `std::mem::forget` with a value that implements Copy" } -declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGET_COPY]); +declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { @@ -132,7 +132,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span }); } sym::mem_forget if is_copy => { - cx.emit_spanned_lint(FORGET_COPY, expr.span, ForgetCopyDiag { arg_ty, label: arg.span }); + cx.emit_spanned_lint(FORGETTING_COPY_TYPES, expr.span, ForgetCopyDiag { arg_ty, label: arg.span }); } _ => return, }; diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 278c0bc32e955..16c81273ef230 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -691,7 +691,7 @@ pub struct ForgetRefDiag<'a> { } #[derive(LintDiagnostic)] -#[diag(lint_forget_copy)] +#[diag(lint_forgetting_copy_types)] #[note] pub struct ForgetCopyDiag<'a> { pub arg_ty: Ty<'a>, diff --git a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs index 9a7b39e1544eb..db1b8494890ec 100644 --- a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs +++ b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs @@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef { let is_copy = is_copy(cx, arg_ty); let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); let (lint, msg) = match fn_name { - // early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forget_copy + // early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forgetting_copy_types sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return, sym::mem_forget if arg_ty.is_ref() => return, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return, diff --git a/src/tools/clippy/clippy_lints/src/renamed_lints.rs b/src/tools/clippy/clippy_lints/src/renamed_lints.rs index 308e40abf6a25..a81dbb9b25992 100644 --- a/src/tools/clippy/clippy_lints/src/renamed_lints.rs +++ b/src/tools/clippy/clippy_lints/src/renamed_lints.rs @@ -38,7 +38,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[ ("clippy::for_loop_over_option", "for_loops_over_fallibles"), ("clippy::for_loop_over_result", "for_loops_over_fallibles"), ("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"), - ("clippy::forget_copy", "forget_copy"), + ("clippy::forget_copy", "forgetting_copy_types"), ("clippy::forget_ref", "forget_ref"), ("clippy::into_iter_on_array", "array_into_iter"), ("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"), diff --git a/src/tools/clippy/tests/ui/mem_forget.rs b/src/tools/clippy/tests/ui/mem_forget.rs index 5137448a6d4ba..edb9d87d032ec 100644 --- a/src/tools/clippy/tests/ui/mem_forget.rs +++ b/src/tools/clippy/tests/ui/mem_forget.rs @@ -5,7 +5,7 @@ use std::mem as memstuff; use std::mem::forget as forgetSomething; #[warn(clippy::mem_forget)] -#[allow(forget_copy)] +#[allow(forgetting_copy_types)] fn main() { let five: i32 = 5; forgetSomething(five); diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index 8633e422805a6..8df63fd9b2335 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -33,7 +33,7 @@ #![allow(dropping_copy_types)] #![allow(drop_ref)] #![allow(for_loops_over_fallibles)] -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] #![allow(forget_ref)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] @@ -82,7 +82,7 @@ #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] -#![warn(forget_copy)] +#![warn(forgetting_copy_types)] #![warn(forget_ref)] #![warn(array_into_iter)] #![warn(invalid_atomic_ordering)] diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index 07b33b4da95b3..7206e19f1e021 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -33,7 +33,7 @@ #![allow(dropping_copy_types)] #![allow(drop_ref)] #![allow(for_loops_over_fallibles)] -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] #![allow(forget_ref)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index 20e7d96b7209b..c2a7c0dd7eb13 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -216,11 +216,11 @@ error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_ov LL | #![warn(clippy::for_loops_over_fallibles)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` -error: lint `clippy::forget_copy` has been renamed to `forget_copy` +error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types` --> $DIR/rename.rs:85:9 | LL | #![warn(clippy::forget_copy)] - | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forget_copy` + | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types` error: lint `clippy::forget_ref` has been renamed to `forget_ref` --> $DIR/rename.rs:86:9 diff --git a/tests/ui/consts/const_forget.rs b/tests/ui/consts/const_forget.rs index acdd6a54cf4ec..f06149f2cb994 100644 --- a/tests/ui/consts/const_forget.rs +++ b/tests/ui/consts/const_forget.rs @@ -1,6 +1,6 @@ // check-pass -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] use std::mem::forget; diff --git a/tests/ui/consts/issue-104155.rs b/tests/ui/consts/issue-104155.rs index b3821f467b617..7b375dc056675 100644 --- a/tests/ui/consts/issue-104155.rs +++ b/tests/ui/consts/issue-104155.rs @@ -1,6 +1,6 @@ // check-pass -#![allow(forget_copy)] +#![allow(forgetting_copy_types)] const _: () = core::mem::forget(Box::::default); const _: () = core::mem::forget(|| Box::::default()); diff --git a/tests/ui/lint/forget_copy.rs b/tests/ui/lint/forgetting_copy_types.rs similarity index 97% rename from tests/ui/lint/forget_copy.rs rename to tests/ui/lint/forgetting_copy_types.rs index a6b17b76971f2..224c7bcd5f63e 100644 --- a/tests/ui/lint/forget_copy.rs +++ b/tests/ui/lint/forgetting_copy_types.rs @@ -1,6 +1,6 @@ // check-pass -#![warn(forget_copy)] +#![warn(forgetting_copy_types)] use std::mem::forget; use std::vec::Vec; diff --git a/tests/ui/lint/forget_copy.stderr b/tests/ui/lint/forgetting_copy_types.stderr similarity index 83% rename from tests/ui/lint/forget_copy.stderr rename to tests/ui/lint/forgetting_copy_types.stderr index 37bc8a8854ee7..cf4e1845f5681 100644 --- a/tests/ui/lint/forget_copy.stderr +++ b/tests/ui/lint/forgetting_copy_types.stderr @@ -1,5 +1,5 @@ warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing - --> $DIR/forget_copy.rs:34:5 + --> $DIR/forgetting_copy_types.rs:34:5 | LL | forget(s1); | ^^^^^^^--^ @@ -8,13 +8,13 @@ LL | forget(s1); | = note: use `let _ = ...` to ignore the expression or result note: the lint level is defined here - --> $DIR/forget_copy.rs:3:9 + --> $DIR/forgetting_copy_types.rs:3:9 | -LL | #![warn(forget_copy)] - | ^^^^^^^^^^^ +LL | #![warn(forgetting_copy_types)] + | ^^^^^^^^^^^^^^^^^^^^^ warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing - --> $DIR/forget_copy.rs:35:5 + --> $DIR/forgetting_copy_types.rs:35:5 | LL | forget(s2); | ^^^^^^^--^ @@ -24,7 +24,7 @@ LL | forget(s2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:36:5 + --> $DIR/forgetting_copy_types.rs:36:5 | LL | forget(s3); | ^^^^^^^--^ @@ -35,7 +35,7 @@ LL | forget(s3); = note: `#[warn(forget_ref)]` on by default warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing - --> $DIR/forget_copy.rs:37:5 + --> $DIR/forgetting_copy_types.rs:37:5 | LL | forget(s4); | ^^^^^^^--^ @@ -45,7 +45,7 @@ LL | forget(s4); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:38:5 + --> $DIR/forgetting_copy_types.rs:38:5 | LL | forget(s5); | ^^^^^^^--^ @@ -55,7 +55,7 @@ LL | forget(s5); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:50:5 + --> $DIR/forgetting_copy_types.rs:50:5 | LL | forget(a2); | ^^^^^^^--^ @@ -65,7 +65,7 @@ LL | forget(a2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:52:5 + --> $DIR/forgetting_copy_types.rs:52:5 | LL | forget(a3); | ^^^^^^^--^ @@ -75,7 +75,7 @@ LL | forget(a3); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_copy.rs:53:5 + --> $DIR/forgetting_copy_types.rs:53:5 | LL | forget(a4); | ^^^^^^^--^ From c93d9c1794eb8d57fd2f108547192c3aeb92b505 Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 19 May 2023 11:25:35 +0200 Subject: [PATCH 3/4] Rename `drop_ref` lint to `dropping_references` --- compiler/rustc_lint/messages.ftl | 2 +- .../rustc_lint/src/drop_forget_useless.rs | 8 ++--- compiler/rustc_lint/src/lints.rs | 4 +-- .../clippy_lints/src/drop_forget_ref.rs | 2 +- .../clippy/clippy_lints/src/renamed_lints.rs | 2 +- src/tools/clippy/tests/ui/rename.fixed | 4 +-- src/tools/clippy/tests/ui/rename.rs | 2 +- src/tools/clippy/tests/ui/rename.stderr | 4 +-- .../fail/stacked_borrows/illegal_write2.rs | 2 +- .../borrowck-closures-slice-patterns-ok.rs | 2 +- .../migrations/issue-78720.rs | 2 +- .../optimization/edge_case_run_pass.rs | 2 +- .../run_pass/drop_then_use_fake_reads.rs | 2 +- tests/ui/drop/repeat-drop.rs | 2 +- .../explicit-call-to-supertrait-dtor.fixed | 2 +- .../explicit-call-to-supertrait-dtor.rs | 2 +- tests/ui/generator/issue-57017.rs | 2 +- tests/ui/illegal-ufcs-drop.fixed | 2 +- tests/ui/illegal-ufcs-drop.rs | 2 +- tests/ui/lint/dropping_copy_types.stderr | 2 +- .../{drop_ref.rs => dropping_references.rs} | 2 +- ..._ref.stderr => dropping_references.stderr} | 30 +++++++++---------- tests/ui/nll/ty-outlives/projection-body.rs | 2 +- .../or-patterns-default-binding-modes.rs | 2 +- .../borrowck-pat-at-and-box-pass.rs | 2 +- .../borrowck-move-ref-pattern-pass.rs | 2 +- ...move-ref-patterns-closure-captures-pass.rs | 2 +- .../borrowck-exhaustive.rs | 2 +- .../new-solver/auto-with-drop_tracking_mir.rs | 2 +- .../trivial-bounds-inconsistent-copy.rs | 2 +- 30 files changed, 50 insertions(+), 50 deletions(-) rename tests/ui/lint/{drop_ref.rs => dropping_references.rs} (99%) rename tests/ui/lint/{drop_ref.stderr => dropping_references.stderr} (86%) diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index f60d48e102499..b0ccbe4b1f1fd 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -521,7 +521,7 @@ lint_opaque_hidden_inferred_bound = opaque type `{$ty}` does not satisfy its ass lint_opaque_hidden_inferred_bound_sugg = add this bound -lint_drop_ref = calls to `std::mem::drop` with a reference instead of an owned value does nothing +lint_dropping_references = calls to `std::mem::drop` with a reference instead of an owned value does nothing .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result diff --git a/compiler/rustc_lint/src/drop_forget_useless.rs b/compiler/rustc_lint/src/drop_forget_useless.rs index 8f3f4914ddea9..b1199096d7c82 100644 --- a/compiler/rustc_lint/src/drop_forget_useless.rs +++ b/compiler/rustc_lint/src/drop_forget_useless.rs @@ -7,7 +7,7 @@ use crate::{ }; declare_lint! { - /// The `drop_ref` lint checks for calls to `std::mem::drop` with a reference + /// The `dropping_references` lint checks for calls to `std::mem::drop` with a reference /// instead of an owned value. /// /// ### Example @@ -29,7 +29,7 @@ declare_lint! { /// reference itself, which is a no-op. It will not call the `drop` method (from /// the `Drop` trait implementation) on the underlying referenced value, which /// is likely what was intended. - pub DROP_REF, + pub DROPPING_REFERENCES, Warn, "calls to `std::mem::drop` with a reference instead of an owned value" } @@ -109,7 +109,7 @@ declare_lint! { "calls to `std::mem::forget` with a value that implements Copy" } -declare_lint_pass!(DropForgetUseless => [DROP_REF, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); +declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { @@ -123,7 +123,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); match fn_name { sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => { - cx.emit_spanned_lint(DROP_REF, expr.span, DropRefDiag { arg_ty, label: arg.span }); + cx.emit_spanned_lint(DROPPING_REFERENCES, expr.span, DropRefDiag { arg_ty, label: arg.span }); }, sym::mem_forget if arg_ty.is_ref() => { cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span }); diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 16c81273ef230..aebfa6f3078cf 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -662,9 +662,9 @@ pub struct ForLoopsOverFalliblesSuggestion<'a> { pub end_span: Span, } -// drop_ref.rs +// drop_forget_useless.rs #[derive(LintDiagnostic)] -#[diag(lint_drop_ref)] +#[diag(lint_dropping_references)] #[note] pub struct DropRefDiag<'a> { pub arg_ty: Ty<'a>, diff --git a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs index db1b8494890ec..00211d65094ee 100644 --- a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs +++ b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs @@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef { let is_copy = is_copy(cx, arg_ty); let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); let (lint, msg) = match fn_name { - // early return for uplifted lints: drop_ref, dropping_copy_types, forget_ref, forgetting_copy_types + // early return for uplifted lints: dropping_references, dropping_copy_types, forget_ref, forgetting_copy_types sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return, sym::mem_forget if arg_ty.is_ref() => return, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return, diff --git a/src/tools/clippy/clippy_lints/src/renamed_lints.rs b/src/tools/clippy/clippy_lints/src/renamed_lints.rs index a81dbb9b25992..4d1a462d110ca 100644 --- a/src/tools/clippy/clippy_lints/src/renamed_lints.rs +++ b/src/tools/clippy/clippy_lints/src/renamed_lints.rs @@ -34,7 +34,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[ ("clippy::clone_double_ref", "suspicious_double_ref_op"), ("clippy::drop_bounds", "drop_bounds"), ("clippy::drop_copy", "dropping_copy_types"), - ("clippy::drop_ref", "drop_ref"), + ("clippy::drop_ref", "dropping_references"), ("clippy::for_loop_over_option", "for_loops_over_fallibles"), ("clippy::for_loop_over_result", "for_loops_over_fallibles"), ("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"), diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index 8df63fd9b2335..a4fb4fbffdfc8 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -31,7 +31,7 @@ #![allow(suspicious_double_ref_op)] #![allow(drop_bounds)] #![allow(dropping_copy_types)] -#![allow(drop_ref)] +#![allow(dropping_references)] #![allow(for_loops_over_fallibles)] #![allow(forgetting_copy_types)] #![allow(forget_ref)] @@ -78,7 +78,7 @@ #![warn(suspicious_double_ref_op)] #![warn(drop_bounds)] #![warn(dropping_copy_types)] -#![warn(drop_ref)] +#![warn(dropping_references)] #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index 7206e19f1e021..bb833c9534688 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -31,7 +31,7 @@ #![allow(suspicious_double_ref_op)] #![allow(drop_bounds)] #![allow(dropping_copy_types)] -#![allow(drop_ref)] +#![allow(dropping_references)] #![allow(for_loops_over_fallibles)] #![allow(forgetting_copy_types)] #![allow(forget_ref)] diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index c2a7c0dd7eb13..8bbd046bbf31b 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -192,11 +192,11 @@ error: lint `clippy::drop_copy` has been renamed to `dropping_copy_types` LL | #![warn(clippy::drop_copy)] | ^^^^^^^^^^^^^^^^^ help: use the new name: `dropping_copy_types` -error: lint `clippy::drop_ref` has been renamed to `drop_ref` +error: lint `clippy::drop_ref` has been renamed to `dropping_references` --> $DIR/rename.rs:81:9 | LL | #![warn(clippy::drop_ref)] - | ^^^^^^^^^^^^^^^^ help: use the new name: `drop_ref` + | ^^^^^^^^^^^^^^^^ help: use the new name: `dropping_references` error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles` --> $DIR/rename.rs:82:9 diff --git a/src/tools/miri/tests/fail/stacked_borrows/illegal_write2.rs b/src/tools/miri/tests/fail/stacked_borrows/illegal_write2.rs index bf4204c61fd72..a5a1930ed65bb 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/illegal_write2.rs +++ b/src/tools/miri/tests/fail/stacked_borrows/illegal_write2.rs @@ -1,4 +1,4 @@ -#![allow(drop_ref)] +#![allow(dropping_references)] fn main() { let target = &mut 42; diff --git a/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs b/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs index 9163c8ed6fb2c..60128c9419d11 100644 --- a/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs +++ b/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs @@ -1,7 +1,7 @@ // Check that closure captures for slice patterns are inferred correctly #![allow(unused_variables)] -#![allow(drop_ref)] +#![allow(dropping_references)] // run-pass diff --git a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs index 5e4c19ff38b20..98f8d5d473380 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs +++ b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs @@ -1,7 +1,7 @@ // run-pass #![warn(rust_2021_incompatible_closure_captures)] -#![allow(drop_ref, dropping_copy_types)] +#![allow(dropping_references, dropping_copy_types)] fn main() { if let a = "" { diff --git a/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs b/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs index 0f15f664e757e..5496d0e5fc7e3 100644 --- a/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs +++ b/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs @@ -3,7 +3,7 @@ #![allow(unused)] #![allow(dead_code)] -#![allow(drop_ref)] +#![allow(dropping_references)] struct Int(i32); struct B<'a>(&'a i32); diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs b/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs index a097424a02172..b5e97ec1c1b8d 100644 --- a/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs +++ b/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs @@ -2,7 +2,7 @@ // check-pass #![feature(rustc_attrs)] -#![allow(drop_ref)] +#![allow(dropping_references)] fn main() { let mut x = 1; diff --git a/tests/ui/drop/repeat-drop.rs b/tests/ui/drop/repeat-drop.rs index a52900311ea65..0afb4bb11bc89 100644 --- a/tests/ui/drop/repeat-drop.rs +++ b/tests/ui/drop/repeat-drop.rs @@ -1,7 +1,7 @@ // run-pass // needs-unwind -#![allow(drop_ref, dropping_copy_types)] +#![allow(dropping_references, dropping_copy_types)] static mut CHECK: usize = 0; diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed b/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed index 0bc4feed329d3..bb093a4af4a3e 100644 --- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed +++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed @@ -1,6 +1,6 @@ // run-rustfix -#![allow(drop_ref)] +#![allow(dropping_references)] struct Foo { x: isize diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs b/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs index 26ae6698d669d..1a9f89c054f39 100644 --- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs +++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs @@ -1,6 +1,6 @@ // run-rustfix -#![allow(drop_ref)] +#![allow(dropping_references)] struct Foo { x: isize diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs index aac6e591e688c..381897c77a5c3 100644 --- a/tests/ui/generator/issue-57017.rs +++ b/tests/ui/generator/issue-57017.rs @@ -5,7 +5,7 @@ // [drop_tracking_mir] build-pass #![feature(generators, negative_impls)] -#![allow(drop_ref, dropping_copy_types)] +#![allow(dropping_references, dropping_copy_types)] macro_rules! type_combinations { ( diff --git a/tests/ui/illegal-ufcs-drop.fixed b/tests/ui/illegal-ufcs-drop.fixed index 8783682dec47d..c088c82791b4d 100644 --- a/tests/ui/illegal-ufcs-drop.fixed +++ b/tests/ui/illegal-ufcs-drop.fixed @@ -1,6 +1,6 @@ // run-rustfix -#![allow(drop_ref)] +#![allow(dropping_references)] struct Foo; diff --git a/tests/ui/illegal-ufcs-drop.rs b/tests/ui/illegal-ufcs-drop.rs index 29774306ec6f5..1389b11218865 100644 --- a/tests/ui/illegal-ufcs-drop.rs +++ b/tests/ui/illegal-ufcs-drop.rs @@ -1,6 +1,6 @@ // run-rustfix -#![allow(drop_ref)] +#![allow(dropping_references)] struct Foo; diff --git a/tests/ui/lint/dropping_copy_types.stderr b/tests/ui/lint/dropping_copy_types.stderr index dc5c6211e7112..b6291aa5ed634 100644 --- a/tests/ui/lint/dropping_copy_types.stderr +++ b/tests/ui/lint/dropping_copy_types.stderr @@ -32,7 +32,7 @@ LL | drop(s3); | argument has type `&SomeStruct` | = note: use `let _ = ...` to ignore the expression or result - = note: `#[warn(drop_ref)]` on by default + = note: `#[warn(dropping_references)]` on by default warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing --> $DIR/dropping_copy_types.rs:37:5 diff --git a/tests/ui/lint/drop_ref.rs b/tests/ui/lint/dropping_references.rs similarity index 99% rename from tests/ui/lint/drop_ref.rs rename to tests/ui/lint/dropping_references.rs index db4f7569f6fa3..0d5d484f4517f 100644 --- a/tests/ui/lint/drop_ref.rs +++ b/tests/ui/lint/dropping_references.rs @@ -1,6 +1,6 @@ // check-pass -#![warn(drop_ref)] +#![warn(dropping_references)] struct SomeStruct; diff --git a/tests/ui/lint/drop_ref.stderr b/tests/ui/lint/dropping_references.stderr similarity index 86% rename from tests/ui/lint/drop_ref.stderr rename to tests/ui/lint/dropping_references.stderr index 04c988fe99da4..7e25a46216ecf 100644 --- a/tests/ui/lint/drop_ref.stderr +++ b/tests/ui/lint/dropping_references.stderr @@ -1,5 +1,5 @@ warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:8:5 + --> $DIR/dropping_references.rs:8:5 | LL | drop(&SomeStruct); | ^^^^^-----------^ @@ -8,13 +8,13 @@ LL | drop(&SomeStruct); | = note: use `let _ = ...` to ignore the expression or result note: the lint level is defined here - --> $DIR/drop_ref.rs:3:9 + --> $DIR/dropping_references.rs:3:9 | -LL | #![warn(drop_ref)] - | ^^^^^^^^ +LL | #![warn(dropping_references)] + | ^^^^^^^^^^^^^^^^^^^ warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:11:5 + --> $DIR/dropping_references.rs:11:5 | LL | drop(&owned1); | ^^^^^-------^ @@ -24,7 +24,7 @@ LL | drop(&owned1); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:12:5 + --> $DIR/dropping_references.rs:12:5 | LL | drop(&&owned1); | ^^^^^--------^ @@ -34,7 +34,7 @@ LL | drop(&&owned1); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:13:5 + --> $DIR/dropping_references.rs:13:5 | LL | drop(&mut owned1); | ^^^^^-----------^ @@ -44,7 +44,7 @@ LL | drop(&mut owned1); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:17:5 + --> $DIR/dropping_references.rs:17:5 | LL | drop(reference1); | ^^^^^----------^ @@ -54,7 +54,7 @@ LL | drop(reference1); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:20:5 + --> $DIR/dropping_references.rs:20:5 | LL | drop(reference2); | ^^^^^----------^ @@ -64,7 +64,7 @@ LL | drop(reference2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:23:5 + --> $DIR/dropping_references.rs:23:5 | LL | drop(reference3); | ^^^^^----------^ @@ -74,7 +74,7 @@ LL | drop(reference3); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:28:5 + --> $DIR/dropping_references.rs:28:5 | LL | drop(&val); | ^^^^^----^ @@ -84,7 +84,7 @@ LL | drop(&val); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:36:5 + --> $DIR/dropping_references.rs:36:5 | LL | std::mem::drop(&SomeStruct); | ^^^^^^^^^^^^^^^-----------^ @@ -94,7 +94,7 @@ LL | std::mem::drop(&SomeStruct); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:91:13 + --> $DIR/dropping_references.rs:91:13 | LL | drop(println_and(&13)); | ^^^^^----------------^ @@ -104,7 +104,7 @@ LL | drop(println_and(&13)); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:94:14 + --> $DIR/dropping_references.rs:94:14 | LL | 3 if drop(println_and(&14)) == () => (), | ^^^^^----------------^ @@ -114,7 +114,7 @@ LL | 3 if drop(println_and(&14)) == () => (), = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing - --> $DIR/drop_ref.rs:96:14 + --> $DIR/dropping_references.rs:96:14 | LL | 4 => drop(&2), | ^^^^^--^ diff --git a/tests/ui/nll/ty-outlives/projection-body.rs b/tests/ui/nll/ty-outlives/projection-body.rs index bff9058a507b1..722d6747102fc 100644 --- a/tests/ui/nll/ty-outlives/projection-body.rs +++ b/tests/ui/nll/ty-outlives/projection-body.rs @@ -3,7 +3,7 @@ // // check-pass -#![allow(drop_ref)] +#![allow(dropping_references)] trait MyTrait<'a> { type Output; diff --git a/tests/ui/or-patterns/or-patterns-default-binding-modes.rs b/tests/ui/or-patterns/or-patterns-default-binding-modes.rs index 398cc0a0ee6e2..df6aab0e6a885 100644 --- a/tests/ui/or-patterns/or-patterns-default-binding-modes.rs +++ b/tests/ui/or-patterns/or-patterns-default-binding-modes.rs @@ -4,7 +4,7 @@ #![allow(irrefutable_let_patterns)] #![allow(dropping_copy_types)] -#![allow(drop_ref)] +#![allow(dropping_references)] fn main() { // A regression test for a mistake we made at one point: diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs index 6184a58b88696..43b53b7cf1f17 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs @@ -2,7 +2,7 @@ // Test `@` patterns combined with `box` patterns. -#![allow(drop_ref)] +#![allow(dropping_references)] #![allow(dropping_copy_types)] #![feature(box_patterns)] diff --git a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs index 0550238549ef3..204cd3e665762 100644 --- a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs +++ b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs @@ -1,6 +1,6 @@ // check-pass -#![allow(drop_ref)] +#![allow(dropping_references)] fn main() {} diff --git a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs index 788975d960aa9..4de1f653db03a 100644 --- a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs +++ b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs @@ -1,6 +1,6 @@ // check-pass -#![allow(drop_ref)] +#![allow(dropping_references)] fn main() { struct U; diff --git a/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs b/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs index 8f45b989f1363..b9ff24c7624dc 100644 --- a/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs +++ b/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs @@ -3,7 +3,7 @@ // check-pass -#![allow(drop_ref)] +#![allow(dropping_references)] // aux-build:monovariants.rs extern crate monovariants; diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs index f115e1433182c..e311a4af2f4ea 100644 --- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs @@ -14,7 +14,7 @@ async fn foo() { #[cfg(fail)] let x = &NotSync; bar().await; - #[allow(drop_ref)] + #[allow(dropping_references)] drop(x); } diff --git a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs index 7b7f4a4efdb85..f98c3164d7eb5 100644 --- a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs +++ b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs @@ -2,7 +2,7 @@ // Check tautalogically false `Copy` bounds #![feature(trivial_bounds)] -#![allow(drop_ref, dropping_copy_types)] +#![allow(dropping_references, dropping_copy_types)] fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds is_copy(&t); From 6b08a745a4d59e9bf51d2d591c569c9e758bd02a Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 19 May 2023 11:30:11 +0200 Subject: [PATCH 4/4] Rename `forget_ref` lint to `forgetting_references` --- compiler/rustc_lint/messages.ftl | 2 +- .../rustc_lint/src/drop_forget_useless.rs | 8 +++---- compiler/rustc_lint/src/lints.rs | 2 +- .../clippy_lints/src/drop_forget_ref.rs | 2 +- .../clippy/clippy_lints/src/renamed_lints.rs | 2 +- src/tools/clippy/tests/ui/rename.fixed | 4 ++-- src/tools/clippy/tests/ui/rename.rs | 2 +- src/tools/clippy/tests/ui/rename.stderr | 4 ++-- tests/ui/lint/forgetting_copy_types.stderr | 2 +- ...forget_ref.rs => forgetting_references.rs} | 2 +- ...ef.stderr => forgetting_references.stderr} | 24 +++++++++---------- 11 files changed, 27 insertions(+), 27 deletions(-) rename tests/ui/lint/{forget_ref.rs => forgetting_references.rs} (97%) rename tests/ui/lint/{forget_ref.stderr => forgetting_references.stderr} (84%) diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index b0ccbe4b1f1fd..e1658d3ff82b7 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -529,7 +529,7 @@ lint_dropping_copy_types = calls to `std::mem::drop` with a value that implement .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result -lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value does nothing +lint_forgetting_references = calls to `std::mem::forget` with a reference instead of an owned value does nothing .label = argument has type `{$arg_ty}` .note = use `let _ = ...` to ignore the expression or result diff --git a/compiler/rustc_lint/src/drop_forget_useless.rs b/compiler/rustc_lint/src/drop_forget_useless.rs index b1199096d7c82..ed2b384805e05 100644 --- a/compiler/rustc_lint/src/drop_forget_useless.rs +++ b/compiler/rustc_lint/src/drop_forget_useless.rs @@ -35,7 +35,7 @@ declare_lint! { } declare_lint! { - /// The `forget_ref` lint checks for calls to `std::mem::forget` with a reference + /// The `forgetting_references` lint checks for calls to `std::mem::forget` with a reference /// instead of an owned value. /// /// ### Example @@ -52,7 +52,7 @@ declare_lint! { /// Calling `forget` on a reference will only forget the /// reference itself, which is a no-op. It will not forget the underlying /// referenced value, which is likely what was intended. - pub FORGET_REF, + pub FORGETTING_REFERENCES, Warn, "calls to `std::mem::forget` with a reference instead of an owned value" } @@ -109,7 +109,7 @@ declare_lint! { "calls to `std::mem::forget` with a value that implements Copy" } -declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGET_REF, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); +declare_lint_pass!(DropForgetUseless => [DROPPING_REFERENCES, FORGETTING_REFERENCES, DROPPING_COPY_TYPES, FORGETTING_COPY_TYPES]); impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { @@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless { cx.emit_spanned_lint(DROPPING_REFERENCES, expr.span, DropRefDiag { arg_ty, label: arg.span }); }, sym::mem_forget if arg_ty.is_ref() => { - cx.emit_spanned_lint(FORGET_REF, expr.span, ForgetRefDiag { arg_ty, label: arg.span }); + cx.emit_spanned_lint(FORGETTING_REFERENCES, expr.span, ForgetRefDiag { arg_ty, label: arg.span }); }, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => { cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span }); diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index aebfa6f3078cf..de1c2be287576 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -682,7 +682,7 @@ pub struct DropCopyDiag<'a> { } #[derive(LintDiagnostic)] -#[diag(lint_forget_ref)] +#[diag(lint_forgetting_references)] #[note] pub struct ForgetRefDiag<'a> { pub arg_ty: Ty<'a>, diff --git a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs index 00211d65094ee..9c60edb179415 100644 --- a/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs +++ b/src/tools/clippy/clippy_lints/src/drop_forget_ref.rs @@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef { let is_copy = is_copy(cx, arg_ty); let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr); let (lint, msg) = match fn_name { - // early return for uplifted lints: dropping_references, dropping_copy_types, forget_ref, forgetting_copy_types + // early return for uplifted lints: dropping_references, dropping_copy_types, forgetting_references, forgetting_copy_types sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => return, sym::mem_forget if arg_ty.is_ref() => return, sym::mem_drop if is_copy && !drop_is_single_call_in_arm => return, diff --git a/src/tools/clippy/clippy_lints/src/renamed_lints.rs b/src/tools/clippy/clippy_lints/src/renamed_lints.rs index 4d1a462d110ca..b0db56bb417ea 100644 --- a/src/tools/clippy/clippy_lints/src/renamed_lints.rs +++ b/src/tools/clippy/clippy_lints/src/renamed_lints.rs @@ -39,7 +39,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[ ("clippy::for_loop_over_result", "for_loops_over_fallibles"), ("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"), ("clippy::forget_copy", "forgetting_copy_types"), - ("clippy::forget_ref", "forget_ref"), + ("clippy::forget_ref", "forgetting_references"), ("clippy::into_iter_on_array", "array_into_iter"), ("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"), ("clippy::invalid_ref", "invalid_value"), diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index a4fb4fbffdfc8..dfe45dec8a745 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -34,7 +34,7 @@ #![allow(dropping_references)] #![allow(for_loops_over_fallibles)] #![allow(forgetting_copy_types)] -#![allow(forget_ref)] +#![allow(forgetting_references)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] #![allow(invalid_value)] @@ -83,7 +83,7 @@ #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] #![warn(forgetting_copy_types)] -#![warn(forget_ref)] +#![warn(forgetting_references)] #![warn(array_into_iter)] #![warn(invalid_atomic_ordering)] #![warn(invalid_value)] diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index bb833c9534688..ce8eca5a3081c 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -34,7 +34,7 @@ #![allow(dropping_references)] #![allow(for_loops_over_fallibles)] #![allow(forgetting_copy_types)] -#![allow(forget_ref)] +#![allow(forgetting_references)] #![allow(array_into_iter)] #![allow(invalid_atomic_ordering)] #![allow(invalid_value)] diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index 8bbd046bbf31b..3fca60aa2ebd3 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -222,11 +222,11 @@ error: lint `clippy::forget_copy` has been renamed to `forgetting_copy_types` LL | #![warn(clippy::forget_copy)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_copy_types` -error: lint `clippy::forget_ref` has been renamed to `forget_ref` +error: lint `clippy::forget_ref` has been renamed to `forgetting_references` --> $DIR/rename.rs:86:9 | LL | #![warn(clippy::forget_ref)] - | ^^^^^^^^^^^^^^^^^^ help: use the new name: `forget_ref` + | ^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_references` error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter` --> $DIR/rename.rs:87:9 diff --git a/tests/ui/lint/forgetting_copy_types.stderr b/tests/ui/lint/forgetting_copy_types.stderr index cf4e1845f5681..36d1ef5c53e93 100644 --- a/tests/ui/lint/forgetting_copy_types.stderr +++ b/tests/ui/lint/forgetting_copy_types.stderr @@ -32,7 +32,7 @@ LL | forget(s3); | argument has type `&SomeStruct` | = note: use `let _ = ...` to ignore the expression or result - = note: `#[warn(forget_ref)]` on by default + = note: `#[warn(forgetting_references)]` on by default warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing --> $DIR/forgetting_copy_types.rs:37:5 diff --git a/tests/ui/lint/forget_ref.rs b/tests/ui/lint/forgetting_references.rs similarity index 97% rename from tests/ui/lint/forget_ref.rs rename to tests/ui/lint/forgetting_references.rs index 13f6d4be3d153..bd51e98003159 100644 --- a/tests/ui/lint/forget_ref.rs +++ b/tests/ui/lint/forgetting_references.rs @@ -1,6 +1,6 @@ // check-pass -#![warn(forget_ref)] +#![warn(forgetting_references)] use std::mem::forget; diff --git a/tests/ui/lint/forget_ref.stderr b/tests/ui/lint/forgetting_references.stderr similarity index 84% rename from tests/ui/lint/forget_ref.stderr rename to tests/ui/lint/forgetting_references.stderr index 63fc779198007..5624b690789f8 100644 --- a/tests/ui/lint/forget_ref.stderr +++ b/tests/ui/lint/forgetting_references.stderr @@ -1,5 +1,5 @@ warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:10:5 + --> $DIR/forgetting_references.rs:10:5 | LL | forget(&SomeStruct); | ^^^^^^^-----------^ @@ -8,13 +8,13 @@ LL | forget(&SomeStruct); | = note: use `let _ = ...` to ignore the expression or result note: the lint level is defined here - --> $DIR/forget_ref.rs:3:9 + --> $DIR/forgetting_references.rs:3:9 | -LL | #![warn(forget_ref)] - | ^^^^^^^^^^ +LL | #![warn(forgetting_references)] + | ^^^^^^^^^^^^^^^^^^^^^ warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:13:5 + --> $DIR/forgetting_references.rs:13:5 | LL | forget(&owned); | ^^^^^^^------^ @@ -24,7 +24,7 @@ LL | forget(&owned); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:14:5 + --> $DIR/forgetting_references.rs:14:5 | LL | forget(&&owned); | ^^^^^^^-------^ @@ -34,7 +34,7 @@ LL | forget(&&owned); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:15:5 + --> $DIR/forgetting_references.rs:15:5 | LL | forget(&mut owned); | ^^^^^^^----------^ @@ -44,7 +44,7 @@ LL | forget(&mut owned); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:19:5 + --> $DIR/forgetting_references.rs:19:5 | LL | forget(&*reference1); | ^^^^^^^------------^ @@ -54,7 +54,7 @@ LL | forget(&*reference1); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:22:5 + --> $DIR/forgetting_references.rs:22:5 | LL | forget(reference2); | ^^^^^^^----------^ @@ -64,7 +64,7 @@ LL | forget(reference2); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:25:5 + --> $DIR/forgetting_references.rs:25:5 | LL | forget(reference3); | ^^^^^^^----------^ @@ -74,7 +74,7 @@ LL | forget(reference3); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:30:5 + --> $DIR/forgetting_references.rs:30:5 | LL | forget(&val); | ^^^^^^^----^ @@ -84,7 +84,7 @@ LL | forget(&val); = note: use `let _ = ...` to ignore the expression or result warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing - --> $DIR/forget_ref.rs:38:5 + --> $DIR/forgetting_references.rs:38:5 | LL | std::mem::forget(&SomeStruct); | ^^^^^^^^^^^^^^^^^-----------^