Rollup merge of #111756 - Urgau:rename_drop_forget_copy_ref_lints, r=fee1-dead

Rename `{drop,forget}_{copy,ref}` lints to more consistent naming

This PR renames previous uplifted lints in https://github.com/rust-lang/rust/pull/109732 to more consistent naming.

I followed the renaming done [here](https://github.com/rust-lang/rust/issues/53224) and also advocated in this [clippy issue](https://github.com/rust-lang/rust-clippy/issues/2845):
   - `drop_copy` to `dropping_copy_types`
   - `forget_copy` to `forgetting_copy_types`
   - `drop_ref` to `dropping_references`
   - `forget_ref` to `forgetting_references`
This commit is contained in:
Dylan DPC 2023-05-23 00:32:19 +05:30 committed by GitHub
commit 71f78682be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 155 additions and 155 deletions

View file

@ -521,18 +521,18 @@ 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
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
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
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

View file

@ -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,13 +29,13 @@ 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"
}
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,13 +52,13 @@ 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"
}
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,13 +76,13 @@ 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"
}
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, DROP_COPY, FORGET_COPY]);
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>) {
@ -123,16 +123,16 @@ 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 });
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(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 });
cx.emit_spanned_lint(FORGETTING_COPY_TYPES, expr.span, ForgetCopyDiag { arg_ty, label: arg.span });
}
_ => return,
};

View file

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

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

View file

@ -33,13 +33,13 @@ 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_ref", "drop_ref"),
("clippy::drop_copy", "dropping_copy_types"),
("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"),
("clippy::forget_copy", "forget_copy"),
("clippy::forget_ref", "forget_ref"),
("clippy::forget_copy", "forgetting_copy_types"),
("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"),

View file

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

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,11 +30,11 @@
#![allow(clippy::invisible_characters)]
#![allow(suspicious_double_ref_op)]
#![allow(drop_bounds)]
#![allow(drop_copy)]
#![allow(drop_ref)]
#![allow(dropping_copy_types)]
#![allow(dropping_references)]
#![allow(for_loops_over_fallibles)]
#![allow(forget_copy)]
#![allow(forget_ref)]
#![allow(forgetting_copy_types)]
#![allow(forgetting_references)]
#![allow(array_into_iter)]
#![allow(invalid_atomic_ordering)]
#![allow(invalid_value)]
@ -77,13 +77,13 @@
#![warn(clippy::invisible_characters)]
#![warn(suspicious_double_ref_op)]
#![warn(drop_bounds)]
#![warn(drop_copy)]
#![warn(drop_ref)]
#![warn(dropping_copy_types)]
#![warn(dropping_references)]
#![warn(for_loops_over_fallibles)]
#![warn(for_loops_over_fallibles)]
#![warn(for_loops_over_fallibles)]
#![warn(forget_copy)]
#![warn(forget_ref)]
#![warn(forgetting_copy_types)]
#![warn(forgetting_references)]
#![warn(array_into_iter)]
#![warn(invalid_atomic_ordering)]
#![warn(invalid_value)]

View file

@ -30,11 +30,11 @@
#![allow(clippy::invisible_characters)]
#![allow(suspicious_double_ref_op)]
#![allow(drop_bounds)]
#![allow(drop_copy)]
#![allow(drop_ref)]
#![allow(dropping_copy_types)]
#![allow(dropping_references)]
#![allow(for_loops_over_fallibles)]
#![allow(forget_copy)]
#![allow(forget_ref)]
#![allow(forgetting_copy_types)]
#![allow(forgetting_references)]
#![allow(array_into_iter)]
#![allow(invalid_atomic_ordering)]
#![allow(invalid_value)]

View file

@ -186,17 +186,17 @@ 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`
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
@ -216,17 +216,17 @@ 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`
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

View file

@ -1,4 +1,4 @@
#![allow(drop_ref)]
#![allow(dropping_references)]
fn main() {
let target = &mut 42;

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 @@
// Check that closure captures for slice patterns are inferred correctly
#![allow(unused_variables)]
#![allow(drop_ref)]
#![allow(dropping_references)]
// run-pass

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(dropping_references, dropping_copy_types)]
fn main() {
if let a = "" {

View file

@ -3,7 +3,7 @@
#![allow(unused)]
#![allow(dead_code)]
#![allow(drop_ref)]
#![allow(dropping_references)]
struct Int(i32);
struct B<'a>(&'a i32);

View file

@ -2,7 +2,7 @@
// check-pass
#![feature(rustc_attrs)]
#![allow(drop_ref)]
#![allow(dropping_references)]
fn main() {
let mut x = 1;

View file

@ -1,6 +1,6 @@
// check-pass
#![allow(forget_copy)]
#![allow(forgetting_copy_types)]
use std::mem::forget;

View file

@ -1,6 +1,6 @@
// check-pass
#![allow(forget_copy)]
#![allow(forgetting_copy_types)]
const _: () = core::mem::forget(Box::<u32>::default);
const _: () = core::mem::forget(|| Box::<u32>::default());

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(dropping_references, dropping_copy_types)]
static mut CHECK: usize = 0;

View file

@ -1,6 +1,6 @@
// run-rustfix
#![allow(drop_ref)]
#![allow(dropping_references)]
struct Foo {
x: isize

View file

@ -1,6 +1,6 @@
// run-rustfix
#![allow(drop_ref)]
#![allow(dropping_references)]
struct Foo {
x: isize

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(dropping_references, 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 @@
// run-rustfix
#![allow(drop_ref)]
#![allow(dropping_references)]
struct Foo;

View file

@ -1,6 +1,6 @@
// run-rustfix
#![allow(drop_ref)]
#![allow(dropping_references)]
struct Foo;

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);
| ^^^^^--^
@ -32,10 +32,10 @@ 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/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,6 +1,6 @@
// check-pass
#![warn(drop_ref)]
#![warn(dropping_references)]
struct SomeStruct;

View file

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

View file

@ -1,6 +1,6 @@
// check-pass
#![warn(forget_copy)]
#![warn(forgetting_copy_types)]
use std::mem::forget;
use std::vec::Vec;

View file

@ -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);
| ^^^^^^^--^
@ -32,10 +32,10 @@ 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/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);
| ^^^^^^^--^

View file

@ -1,6 +1,6 @@
// check-pass
#![warn(forget_ref)]
#![warn(forgetting_references)]
use std::mem::forget;

View file

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

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(drop_ref)]
#![allow(dropping_references)]
trait MyTrait<'a> {
type Output;

View file

@ -3,8 +3,8 @@
// check-pass
#![allow(irrefutable_let_patterns)]
#![allow(drop_copy)]
#![allow(drop_ref)]
#![allow(dropping_copy_types)]
#![allow(dropping_references)]
fn main() {
// A regression test for a mistake we made at one point:

View file

@ -2,8 +2,8 @@
// Test `@` patterns combined with `box` patterns.
#![allow(drop_ref)]
#![allow(drop_copy)]
#![allow(dropping_references)]
#![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

@ -1,6 +1,6 @@
// check-pass
#![allow(drop_ref)]
#![allow(dropping_references)]
fn main() {}

View file

@ -1,6 +1,6 @@
// check-pass
#![allow(drop_ref)]
#![allow(dropping_references)]
fn main() {
struct U;

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

@ -3,7 +3,7 @@
// check-pass
#![allow(drop_ref)]
#![allow(dropping_references)]
// aux-build:monovariants.rs
extern crate monovariants;

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

@ -14,7 +14,7 @@ async fn foo() {
#[cfg(fail)]
let x = &NotSync;
bar().await;
#[allow(drop_ref)]
#[allow(dropping_references)]
drop(x);
}

View file

@ -2,7 +2,7 @@
// Check tautalogically false `Copy` bounds
#![feature(trivial_bounds)]
#![allow(drop_ref, drop_copy)]
#![allow(dropping_references, dropping_copy_types)]
fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds
is_copy(&t);