Skip to content

Commit d3cb1ce

Browse files
Rollup merge of #130833 - makai410:master, r=compiler-errors,fee1-dead
Fix the misleading diagnostic for `let_underscore_drop` on type without `Drop` implementation Closes: #130430 r? rust-lang/diagnostics
2 parents 0acddf5 + 5892187 commit d3cb1ce

8 files changed

+10
-10
lines changed

compiler/rustc_lint/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ lint_non_binding_let_multi_suggestion =
531531
consider immediately dropping the value
532532
533533
lint_non_binding_let_on_drop_type =
534-
non-binding let on a type that implements `Drop`
534+
non-binding let on a type that has a destructor
535535
536536
lint_non_binding_let_on_sync_lock = non-binding let on a synchronization lock
537537
.label = this lock is not assigned to a binding and is immediately dropped

compiler/rustc_lint/src/let_underscore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ declare_lint! {
5151
/// intent.
5252
pub LET_UNDERSCORE_DROP,
5353
Allow,
54-
"non-binding let on a type that implements `Drop`"
54+
"non-binding let on a type that has a destructor"
5555
}
5656

5757
declare_lint! {

tests/ui/lint/let_underscore/issue-119696-err-on-fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![deny(let_underscore_drop)]
44
fn main() {
5-
let _ = foo(); //~ ERROR non-binding let on a type that implements `Drop`
5+
let _ = foo(); //~ ERROR non-binding let on a type that has a destructor
66
}
77

88
async fn from_config(_: Config) {}

tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: non-binding let on a type that implements `Drop`
1+
error: non-binding let on a type that has a destructor
22
--> $DIR/issue-119696-err-on-fn.rs:5:5
33
|
44
LL | let _ = foo();

tests/ui/lint/let_underscore/issue-119697-extra-let.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ pub fn ice_cold(beverage: Tait) {
1212
// Must destructure at least one field of `Foo`
1313
let Foo { field } = beverage;
1414
// boom
15-
_ = field; //~ ERROR non-binding let on a type that implements `Drop`
15+
_ = field; //~ ERROR non-binding let on a type that has a destructor
1616

17-
let _ = field; //~ ERROR non-binding let on a type that implements `Drop`
17+
let _ = field; //~ ERROR non-binding let on a type that has a destructor
1818
}
1919

2020

tests/ui/lint/let_underscore/issue-119697-extra-let.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: non-binding let on a type that implements `Drop`
1+
error: non-binding let on a type that has a destructor
22
--> $DIR/issue-119697-extra-let.rs:15:5
33
|
44
LL | _ = field;
@@ -18,7 +18,7 @@ help: consider immediately dropping the value
1818
LL | drop(field);
1919
| ~~~~~ +
2020

21-
error: non-binding let on a type that implements `Drop`
21+
error: non-binding let on a type that has a destructor
2222
--> $DIR/issue-119697-extra-let.rs:17:5
2323
|
2424
LL | let _ = field;

tests/ui/lint/let_underscore/let_underscore_drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ impl Drop for NontrivialDrop {
1010
}
1111

1212
fn main() {
13-
let _ = NontrivialDrop; //~WARNING non-binding let on a type that implements `Drop`
13+
let _ = NontrivialDrop; //~WARNING non-binding let on a type that has a destructor
1414

1515
let (_, _) = (NontrivialDrop, NontrivialDrop); // This should be ignored.
1616
}

tests/ui/lint/let_underscore/let_underscore_drop.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: non-binding let on a type that implements `Drop`
1+
warning: non-binding let on a type that has a destructor
22
--> $DIR/let_underscore_drop.rs:13:5
33
|
44
LL | let _ = NontrivialDrop;

0 commit comments

Comments
 (0)