Skip to content

Commit d23f895

Browse files
committed
Improve warning message by saying that it "does nothing"
1 parent 457fa95 commit d23f895

File tree

5 files changed

+43
-43
lines changed

5 files changed

+43
-43
lines changed

compiler/rustc_lint/messages.ftl

+4-4
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,14 @@ lint_opaque_hidden_inferred_bound = opaque type `{$ty}` does not satisfy its ass
521521
522522
lint_opaque_hidden_inferred_bound_sugg = add this bound
523523
524-
lint_drop_ref = calls to `std::mem::drop` with a reference instead of an owned value
524+
lint_drop_ref = calls to `std::mem::drop` with a reference instead of an owned value does nothing
525525
.label = argument has type `{$arg_ty}`
526526
527-
lint_drop_copy = calls to `std::mem::drop` with a value that implements `Copy`.
527+
lint_drop_copy = calls to `std::mem::drop` with a value that implements `Copy` does nothing
528528
.label = argument has type `{$arg_ty}`
529529
530-
lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value
530+
lint_forget_ref = calls to `std::mem::forget` with a reference instead of an owned value does nothing
531531
.label = argument has type `{$arg_ty}`
532532
533-
lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy`.
533+
lint_forget_copy = calls to `std::mem::forget` with a value that implements `Copy` does nothing
534534
.label = argument has type `{$arg_ty}`

tests/ui/lint/drop_copy.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: calls to `std::mem::drop` with a value that implements `Copy`.
1+
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
22
--> $DIR/drop_copy.rs:34:5
33
|
44
LL | drop(s1);
@@ -12,15 +12,15 @@ note: the lint level is defined here
1212
LL | #![warn(drop_copy)]
1313
| ^^^^^^^^^
1414

15-
warning: calls to `std::mem::drop` with a value that implements `Copy`.
15+
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
1616
--> $DIR/drop_copy.rs:35:5
1717
|
1818
LL | drop(s2);
1919
| ^^^^^--^
2020
| |
2121
| argument has type `SomeStruct`
2222

23-
warning: calls to `std::mem::drop` with a reference instead of an owned value
23+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
2424
--> $DIR/drop_copy.rs:36:5
2525
|
2626
LL | drop(s3);
@@ -30,55 +30,55 @@ LL | drop(s3);
3030
|
3131
= note: `#[warn(drop_ref)]` on by default
3232

33-
warning: calls to `std::mem::drop` with a value that implements `Copy`.
33+
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
3434
--> $DIR/drop_copy.rs:37:5
3535
|
3636
LL | drop(s4);
3737
| ^^^^^--^
3838
| |
3939
| argument has type `SomeStruct`
4040

41-
warning: calls to `std::mem::drop` with a reference instead of an owned value
41+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
4242
--> $DIR/drop_copy.rs:38:5
4343
|
4444
LL | drop(s5);
4545
| ^^^^^--^
4646
| |
4747
| argument has type `&SomeStruct`
4848

49-
warning: calls to `std::mem::drop` with a reference instead of an owned value
49+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
5050
--> $DIR/drop_copy.rs:50:5
5151
|
5252
LL | drop(a2);
5353
| ^^^^^--^
5454
| |
5555
| argument has type `&AnotherStruct`
5656

57-
warning: calls to `std::mem::drop` with a reference instead of an owned value
57+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
5858
--> $DIR/drop_copy.rs:52:5
5959
|
6060
LL | drop(a4);
6161
| ^^^^^--^
6262
| |
6363
| argument has type `&AnotherStruct`
6464

65-
warning: calls to `std::mem::drop` with a value that implements `Copy`.
65+
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
6666
--> $DIR/drop_copy.rs:71:13
6767
|
6868
LL | drop(println_and(13));
6969
| ^^^^^---------------^
7070
| |
7171
| argument has type `i32`
7272

73-
warning: calls to `std::mem::drop` with a value that implements `Copy`.
73+
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
7474
--> $DIR/drop_copy.rs:74:14
7575
|
7676
LL | 3 if drop(println_and(14)) == () => (),
7777
| ^^^^^---------------^
7878
| |
7979
| argument has type `i32`
8080

81-
warning: calls to `std::mem::drop` with a value that implements `Copy`.
81+
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
8282
--> $DIR/drop_copy.rs:76:14
8383
|
8484
LL | 4 => drop(2),

tests/ui/lint/drop_ref.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: calls to `std::mem::drop` with a reference instead of an owned value
1+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
22
--> $DIR/drop_ref.rs:8:5
33
|
44
LL | drop(&SomeStruct);
@@ -12,87 +12,87 @@ note: the lint level is defined here
1212
LL | #![warn(drop_ref)]
1313
| ^^^^^^^^
1414

15-
warning: calls to `std::mem::drop` with a reference instead of an owned value
15+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
1616
--> $DIR/drop_ref.rs:11:5
1717
|
1818
LL | drop(&owned1);
1919
| ^^^^^-------^
2020
| |
2121
| argument has type `&SomeStruct`
2222

23-
warning: calls to `std::mem::drop` with a reference instead of an owned value
23+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
2424
--> $DIR/drop_ref.rs:12:5
2525
|
2626
LL | drop(&&owned1);
2727
| ^^^^^--------^
2828
| |
2929
| argument has type `&&SomeStruct`
3030

31-
warning: calls to `std::mem::drop` with a reference instead of an owned value
31+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
3232
--> $DIR/drop_ref.rs:13:5
3333
|
3434
LL | drop(&mut owned1);
3535
| ^^^^^-----------^
3636
| |
3737
| argument has type `&mut SomeStruct`
3838

39-
warning: calls to `std::mem::drop` with a reference instead of an owned value
39+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
4040
--> $DIR/drop_ref.rs:17:5
4141
|
4242
LL | drop(reference1);
4343
| ^^^^^----------^
4444
| |
4545
| argument has type `&SomeStruct`
4646

47-
warning: calls to `std::mem::drop` with a reference instead of an owned value
47+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
4848
--> $DIR/drop_ref.rs:20:5
4949
|
5050
LL | drop(reference2);
5151
| ^^^^^----------^
5252
| |
5353
| argument has type `&mut SomeStruct`
5454

55-
warning: calls to `std::mem::drop` with a reference instead of an owned value
55+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
5656
--> $DIR/drop_ref.rs:23:5
5757
|
5858
LL | drop(reference3);
5959
| ^^^^^----------^
6060
| |
6161
| argument has type `&SomeStruct`
6262

63-
warning: calls to `std::mem::drop` with a reference instead of an owned value
63+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
6464
--> $DIR/drop_ref.rs:28:5
6565
|
6666
LL | drop(&val);
6767
| ^^^^^----^
6868
| |
6969
| argument has type `&T`
7070

71-
warning: calls to `std::mem::drop` with a reference instead of an owned value
71+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
7272
--> $DIR/drop_ref.rs:36:5
7373
|
7474
LL | std::mem::drop(&SomeStruct);
7575
| ^^^^^^^^^^^^^^^-----------^
7676
| |
7777
| argument has type `&SomeStruct`
7878

79-
warning: calls to `std::mem::drop` with a reference instead of an owned value
79+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
8080
--> $DIR/drop_ref.rs:91:13
8181
|
8282
LL | drop(println_and(&13));
8383
| ^^^^^----------------^
8484
| |
8585
| argument has type `&i32`
8686

87-
warning: calls to `std::mem::drop` with a reference instead of an owned value
87+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
8888
--> $DIR/drop_ref.rs:94:14
8989
|
9090
LL | 3 if drop(println_and(&14)) == () => (),
9191
| ^^^^^----------------^
9292
| |
9393
| argument has type `&i32`
9494

95-
warning: calls to `std::mem::drop` with a reference instead of an owned value
95+
warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
9696
--> $DIR/drop_ref.rs:96:14
9797
|
9898
LL | 4 => drop(&2),

tests/ui/lint/forget_copy.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: calls to `std::mem::forget` with a value that implements `Copy`.
1+
warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
22
--> $DIR/forget_copy.rs:34:5
33
|
44
LL | forget(s1);
@@ -12,15 +12,15 @@ note: the lint level is defined here
1212
LL | #![warn(forget_copy)]
1313
| ^^^^^^^^^^^
1414

15-
warning: calls to `std::mem::forget` with a value that implements `Copy`.
15+
warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
1616
--> $DIR/forget_copy.rs:35:5
1717
|
1818
LL | forget(s2);
1919
| ^^^^^^^--^
2020
| |
2121
| argument has type `SomeStruct`
2222

23-
warning: calls to `std::mem::forget` with a reference instead of an owned value
23+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
2424
--> $DIR/forget_copy.rs:36:5
2525
|
2626
LL | forget(s3);
@@ -30,39 +30,39 @@ LL | forget(s3);
3030
|
3131
= note: `#[warn(forget_ref)]` on by default
3232

33-
warning: calls to `std::mem::forget` with a value that implements `Copy`.
33+
warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
3434
--> $DIR/forget_copy.rs:37:5
3535
|
3636
LL | forget(s4);
3737
| ^^^^^^^--^
3838
| |
3939
| argument has type `SomeStruct`
4040

41-
warning: calls to `std::mem::forget` with a reference instead of an owned value
41+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
4242
--> $DIR/forget_copy.rs:38:5
4343
|
4444
LL | forget(s5);
4545
| ^^^^^^^--^
4646
| |
4747
| argument has type `&SomeStruct`
4848

49-
warning: calls to `std::mem::forget` with a reference instead of an owned value
49+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
5050
--> $DIR/forget_copy.rs:50:5
5151
|
5252
LL | forget(a2);
5353
| ^^^^^^^--^
5454
| |
5555
| argument has type `&AnotherStruct`
5656

57-
warning: calls to `std::mem::forget` with a reference instead of an owned value
57+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
5858
--> $DIR/forget_copy.rs:52:5
5959
|
6060
LL | forget(a3);
6161
| ^^^^^^^--^
6262
| |
6363
| argument has type `&AnotherStruct`
6464

65-
warning: calls to `std::mem::forget` with a reference instead of an owned value
65+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
6666
--> $DIR/forget_copy.rs:53:5
6767
|
6868
LL | forget(a4);

tests/ui/lint/forget_ref.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: calls to `std::mem::forget` with a reference instead of an owned value
1+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
22
--> $DIR/forget_ref.rs:10:5
33
|
44
LL | forget(&SomeStruct);
@@ -12,63 +12,63 @@ note: the lint level is defined here
1212
LL | #![warn(forget_ref)]
1313
| ^^^^^^^^^^
1414

15-
warning: calls to `std::mem::forget` with a reference instead of an owned value
15+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
1616
--> $DIR/forget_ref.rs:13:5
1717
|
1818
LL | forget(&owned);
1919
| ^^^^^^^------^
2020
| |
2121
| argument has type `&SomeStruct`
2222

23-
warning: calls to `std::mem::forget` with a reference instead of an owned value
23+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
2424
--> $DIR/forget_ref.rs:14:5
2525
|
2626
LL | forget(&&owned);
2727
| ^^^^^^^-------^
2828
| |
2929
| argument has type `&&SomeStruct`
3030

31-
warning: calls to `std::mem::forget` with a reference instead of an owned value
31+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
3232
--> $DIR/forget_ref.rs:15:5
3333
|
3434
LL | forget(&mut owned);
3535
| ^^^^^^^----------^
3636
| |
3737
| argument has type `&mut SomeStruct`
3838

39-
warning: calls to `std::mem::forget` with a reference instead of an owned value
39+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
4040
--> $DIR/forget_ref.rs:19:5
4141
|
4242
LL | forget(&*reference1);
4343
| ^^^^^^^------------^
4444
| |
4545
| argument has type `&SomeStruct`
4646

47-
warning: calls to `std::mem::forget` with a reference instead of an owned value
47+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
4848
--> $DIR/forget_ref.rs:22:5
4949
|
5050
LL | forget(reference2);
5151
| ^^^^^^^----------^
5252
| |
5353
| argument has type `&mut SomeStruct`
5454

55-
warning: calls to `std::mem::forget` with a reference instead of an owned value
55+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
5656
--> $DIR/forget_ref.rs:25:5
5757
|
5858
LL | forget(reference3);
5959
| ^^^^^^^----------^
6060
| |
6161
| argument has type `&SomeStruct`
6262

63-
warning: calls to `std::mem::forget` with a reference instead of an owned value
63+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
6464
--> $DIR/forget_ref.rs:30:5
6565
|
6666
LL | forget(&val);
6767
| ^^^^^^^----^
6868
| |
6969
| argument has type `&T`
7070

71-
warning: calls to `std::mem::forget` with a reference instead of an owned value
71+
warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
7272
--> $DIR/forget_ref.rs:38:5
7373
|
7474
LL | std::mem::forget(&SomeStruct);

0 commit comments

Comments
 (0)