Rename drop_copy lint to dropping_copy_types

This commit is contained in:
Urgau 2023-05-19 11:14:55 +02:00
parent d77014a608
commit 1c7ab18c08
43 changed files with 60 additions and 60 deletions

View File

@ -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

View File

@ -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 });

View File

@ -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>,

View File

@ -968,7 +968,7 @@ pub const fn replace<T>(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);
///

View File

@ -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,

View File

@ -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"),

View File

@ -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;

View File

@ -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)]

View File

@ -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)]

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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];

View File

@ -3,7 +3,7 @@
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
use std::convert::identity;

View File

@ -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<isize> }

View File

@ -1,7 +1,7 @@
// run-pass
// pretty-expanded FIXME #23616
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
struct A { a: isize, b: Box<isize> }

View File

@ -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 = "" {

View File

@ -1,7 +1,7 @@
// run-pass
// pretty-expanded FIXME #23616
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
fn main() {
use ::std::mem;

View File

@ -1,7 +1,7 @@
// run-pass
// needs-unwind
#![allow(drop_ref, drop_copy)]
#![allow(drop_ref, dropping_copy_types)]
static mut CHECK: usize = 0;

View File

@ -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;

View File

@ -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 {
(

View File

@ -3,7 +3,7 @@
// run-pass
#![feature(generators, generator_trait)]
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
use std::marker::{PhantomPinned, Unpin};

View File

@ -1,5 +1,5 @@
#![feature(generators)]
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
// run-pass

View File

@ -1,7 +1,7 @@
// check-pass
#![feature(decl_macro)]
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
macro mac() {
mod m {

View File

@ -1,6 +1,6 @@
// check-pass
#![warn(drop_copy)]
#![warn(dropping_copy_types)]
use std::mem::drop;
use std::vec::Vec;

View File

@ -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),
| ^^^^^-^

View File

@ -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;

View File

@ -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.

View File

@ -3,7 +3,7 @@
// check-pass
#![feature(never_type)]
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
#![warn(unused)]
fn main() {

View File

@ -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!()

View File

@ -3,7 +3,7 @@
// check-pass
#![allow(irrefutable_let_patterns)]
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
#![allow(drop_ref)]
fn main() {

View File

@ -3,7 +3,7 @@
// Test `@` patterns combined with `box` patterns.
#![allow(drop_ref)]
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
#![feature(box_patterns)]

View File

@ -2,7 +2,7 @@
// Test `Copy` bindings in the rhs of `@` patterns.
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
#[derive(Copy, Clone)]
struct C;

View File

@ -3,7 +3,7 @@
// build-pass
// ignore-pass
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
async fn wait() {}

View File

@ -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 = || {

View File

@ -3,7 +3,7 @@
// check-pass
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
use std::marker::PhantomData;

View File

@ -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;

View File

@ -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`

View File

@ -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`

View File

@ -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]

View File

@ -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,

View File

@ -6,7 +6,7 @@
// check-pass
#![allow(drop_copy)]
#![allow(dropping_copy_types)]
trait A {
type B;

View File

@ -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);