From d23f8957ae9f6a2e3121529422e7883d8bdbcc14 Mon Sep 17 00:00:00 2001 From: Urgau Date: Fri, 14 Apr 2023 21:49:05 +0200 Subject: [PATCH] Improve warning message by saying that it "does nothing" --- compiler/rustc_lint/messages.ftl | 8 ++++---- tests/ui/lint/drop_copy.stderr | 20 ++++++++++---------- tests/ui/lint/drop_ref.stderr | 24 ++++++++++++------------ tests/ui/lint/forget_copy.stderr | 16 ++++++++-------- tests/ui/lint/forget_ref.stderr | 18 +++++++++--------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 63424148e4d..e323570b5bc 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -521,14 +521,14 @@ 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 +lint_drop_ref = calls to `std::mem::drop` with a reference instead of an owned value does nothing .label = argument has type `{$arg_ty}` -lint_drop_copy = calls to `std::mem::drop` with a value that implements `Copy`. +lint_drop_copy = calls to `std::mem::drop` with a value that implements `Copy` does nothing .label = argument has type `{$arg_ty}` -lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value +lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value does nothing .label = argument has type `{$arg_ty}` -lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy`. +lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy` does nothing .label = argument has type `{$arg_ty}` diff --git a/tests/ui/lint/drop_copy.stderr b/tests/ui/lint/drop_copy.stderr index a7a3b0e25ec..2f122ad2aaa 100644 --- a/tests/ui/lint/drop_copy.stderr +++ b/tests/ui/lint/drop_copy.stderr @@ -1,4 +1,4 @@ -warning: calls to `std::mem::drop` with a value that implements `Copy`. +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing --> $DIR/drop_copy.rs:34:5 | LL | drop(s1); @@ -12,7 +12,7 @@ note: the lint level is defined here LL | #![warn(drop_copy)] | ^^^^^^^^^ -warning: calls to `std::mem::drop` with a value that implements `Copy`. +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing --> $DIR/drop_copy.rs:35:5 | LL | drop(s2); @@ -20,7 +20,7 @@ LL | drop(s2); | | | argument has type `SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_copy.rs:36:5 | LL | drop(s3); @@ -30,7 +30,7 @@ LL | drop(s3); | = note: `#[warn(drop_ref)]` on by default -warning: calls to `std::mem::drop` with a value that implements `Copy`. +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing --> $DIR/drop_copy.rs:37:5 | LL | drop(s4); @@ -38,7 +38,7 @@ LL | drop(s4); | | | argument has type `SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_copy.rs:38:5 | LL | drop(s5); @@ -46,7 +46,7 @@ LL | drop(s5); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_copy.rs:50:5 | LL | drop(a2); @@ -54,7 +54,7 @@ LL | drop(a2); | | | argument has type `&AnotherStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_copy.rs:52:5 | LL | drop(a4); @@ -62,7 +62,7 @@ LL | drop(a4); | | | argument has type `&AnotherStruct` -warning: calls to `std::mem::drop` with a value that implements `Copy`. +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing --> $DIR/drop_copy.rs:71:13 | LL | drop(println_and(13)); @@ -70,7 +70,7 @@ LL | drop(println_and(13)); | | | argument has type `i32` -warning: calls to `std::mem::drop` with a value that implements `Copy`. +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing --> $DIR/drop_copy.rs:74:14 | LL | 3 if drop(println_and(14)) == () => (), @@ -78,7 +78,7 @@ LL | 3 if drop(println_and(14)) == () => (), | | | argument has type `i32` -warning: calls to `std::mem::drop` with a value that implements `Copy`. +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing --> $DIR/drop_copy.rs:76:14 | LL | 4 => drop(2), diff --git a/tests/ui/lint/drop_ref.stderr b/tests/ui/lint/drop_ref.stderr index c701f99fa90..cd81f72d6e9 100644 --- a/tests/ui/lint/drop_ref.stderr +++ b/tests/ui/lint/drop_ref.stderr @@ -1,4 +1,4 @@ -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:8:5 | LL | drop(&SomeStruct); @@ -12,7 +12,7 @@ note: the lint level is defined here LL | #![warn(drop_ref)] | ^^^^^^^^ -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:11:5 | LL | drop(&owned1); @@ -20,7 +20,7 @@ LL | drop(&owned1); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:12:5 | LL | drop(&&owned1); @@ -28,7 +28,7 @@ LL | drop(&&owned1); | | | argument has type `&&SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:13:5 | LL | drop(&mut owned1); @@ -36,7 +36,7 @@ LL | drop(&mut owned1); | | | argument has type `&mut SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:17:5 | LL | drop(reference1); @@ -44,7 +44,7 @@ LL | drop(reference1); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:20:5 | LL | drop(reference2); @@ -52,7 +52,7 @@ LL | drop(reference2); | | | argument has type `&mut SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:23:5 | LL | drop(reference3); @@ -60,7 +60,7 @@ LL | drop(reference3); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:28:5 | LL | drop(&val); @@ -68,7 +68,7 @@ LL | drop(&val); | | | argument has type `&T` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:36:5 | LL | std::mem::drop(&SomeStruct); @@ -76,7 +76,7 @@ LL | std::mem::drop(&SomeStruct); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:91:13 | LL | drop(println_and(&13)); @@ -84,7 +84,7 @@ LL | drop(println_and(&13)); | | | argument has type `&i32` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:94:14 | LL | 3 if drop(println_and(&14)) == () => (), @@ -92,7 +92,7 @@ LL | 3 if drop(println_and(&14)) == () => (), | | | argument has type `&i32` -warning: calls to `std::mem::drop` with a reference instead of an owned value +warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing --> $DIR/drop_ref.rs:96:14 | LL | 4 => drop(&2), diff --git a/tests/ui/lint/forget_copy.stderr b/tests/ui/lint/forget_copy.stderr index e2fc0f8af4f..b5ce052d379 100644 --- a/tests/ui/lint/forget_copy.stderr +++ b/tests/ui/lint/forget_copy.stderr @@ -1,4 +1,4 @@ -warning: calls to `std::mem::forget` with a value that implements `Copy`. +warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing --> $DIR/forget_copy.rs:34:5 | LL | forget(s1); @@ -12,7 +12,7 @@ note: the lint level is defined here LL | #![warn(forget_copy)] | ^^^^^^^^^^^ -warning: calls to `std::mem::forget` with a value that implements `Copy`. +warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing --> $DIR/forget_copy.rs:35:5 | LL | forget(s2); @@ -20,7 +20,7 @@ LL | forget(s2); | | | argument has type `SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_copy.rs:36:5 | LL | forget(s3); @@ -30,7 +30,7 @@ LL | forget(s3); | = note: `#[warn(forget_ref)]` on by default -warning: calls to `std::mem::forget` with a value that implements `Copy`. +warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing --> $DIR/forget_copy.rs:37:5 | LL | forget(s4); @@ -38,7 +38,7 @@ LL | forget(s4); | | | argument has type `SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_copy.rs:38:5 | LL | forget(s5); @@ -46,7 +46,7 @@ LL | forget(s5); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_copy.rs:50:5 | LL | forget(a2); @@ -54,7 +54,7 @@ LL | forget(a2); | | | argument has type `&AnotherStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_copy.rs:52:5 | LL | forget(a3); @@ -62,7 +62,7 @@ LL | forget(a3); | | | argument has type `&AnotherStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_copy.rs:53:5 | LL | forget(a4); diff --git a/tests/ui/lint/forget_ref.stderr b/tests/ui/lint/forget_ref.stderr index 96fb217215a..f20f5f54b25 100644 --- a/tests/ui/lint/forget_ref.stderr +++ b/tests/ui/lint/forget_ref.stderr @@ -1,4 +1,4 @@ -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:10:5 | LL | forget(&SomeStruct); @@ -12,7 +12,7 @@ note: the lint level is defined here LL | #![warn(forget_ref)] | ^^^^^^^^^^ -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:13:5 | LL | forget(&owned); @@ -20,7 +20,7 @@ LL | forget(&owned); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:14:5 | LL | forget(&&owned); @@ -28,7 +28,7 @@ LL | forget(&&owned); | | | argument has type `&&SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:15:5 | LL | forget(&mut owned); @@ -36,7 +36,7 @@ LL | forget(&mut owned); | | | argument has type `&mut SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:19:5 | LL | forget(&*reference1); @@ -44,7 +44,7 @@ LL | forget(&*reference1); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:22:5 | LL | forget(reference2); @@ -52,7 +52,7 @@ LL | forget(reference2); | | | argument has type `&mut SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:25:5 | LL | forget(reference3); @@ -60,7 +60,7 @@ LL | forget(reference3); | | | argument has type `&SomeStruct` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:30:5 | LL | forget(&val); @@ -68,7 +68,7 @@ LL | forget(&val); | | | argument has type `&T` -warning: calls to `std::mem::forget` with a reference instead of an owned value +warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing --> $DIR/forget_ref.rs:38:5 | LL | std::mem::forget(&SomeStruct);