Skip to content

Commit fc5fc63

Browse files
committed
Test that we lint the awaited expression
1 parent 3a96f54 commit fc5fc63

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

tests/ui/used_underscore_binding.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,20 @@ fn non_variables() {
8787
let f = _fn_test;
8888
f();
8989
}
90-
// Tests that we do not lint if the binding comes from await desugaring.
91-
// See issue 5360.
90+
91+
// Tests that we do not lint if the binding comes from await desugaring,
92+
// but we do lint the awaited expression. See issue 5360.
9293
async fn await_desugaring() {
9394
async fn foo() {}
95+
fn uses_i(_i: i32) {}
96+
9497
foo().await;
98+
({
99+
let _i = 5;
100+
uses_i(_i);
101+
foo()
102+
})
103+
.await
95104
}
96105

97106
fn main() {

tests/ui/used_underscore_binding.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,11 @@ error: used binding `_underscore_field` which is prefixed with an underscore. A
3030
LL | s._underscore_field += 1;
3131
| ^^^^^^^^^^^^^^^^^^^
3232

33-
error: aborting due to 5 previous errors
33+
error: used binding `_i` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
34+
--> $DIR/used_underscore_binding.rs:100:16
35+
|
36+
LL | uses_i(_i);
37+
| ^^
38+
39+
error: aborting due to 6 previous errors
3440

0 commit comments

Comments
 (0)