diff options
| author | Eduardo Broto <ebroto@tutanota.com> | 2020-04-27 21:12:39 +0200 |
|---|---|---|
| committer | Eduardo Broto <ebroto@tutanota.com> | 2020-04-27 21:29:31 +0200 |
| commit | fc5fc6378cfa384c02020c63cbc1472f0844065d (patch) | |
| tree | 32f478812a2481056eb209301fb5f1871d872103 | |
| parent | 3a96f548d1a8e3f7775a5134c83d4bffa33258ce (diff) | |
| download | rust-fc5fc6378cfa384c02020c63cbc1472f0844065d.tar.gz rust-fc5fc6378cfa384c02020c63cbc1472f0844065d.zip | |
Test that we lint the awaited expression
| -rw-r--r-- | tests/ui/used_underscore_binding.rs | 13 | ||||
| -rw-r--r-- | tests/ui/used_underscore_binding.stderr | 8 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/ui/used_underscore_binding.rs b/tests/ui/used_underscore_binding.rs index c94bee1d162..8e0243c49aa 100644 --- a/tests/ui/used_underscore_binding.rs +++ b/tests/ui/used_underscore_binding.rs @@ -87,11 +87,20 @@ fn non_variables() { let f = _fn_test; f(); } -// Tests that we do not lint if the binding comes from await desugaring. -// See issue 5360. + +// Tests that we do not lint if the binding comes from await desugaring, +// but we do lint the awaited expression. See issue 5360. async fn await_desugaring() { async fn foo() {} + fn uses_i(_i: i32) {} + foo().await; + ({ + let _i = 5; + uses_i(_i); + foo() + }) + .await } fn main() { diff --git a/tests/ui/used_underscore_binding.stderr b/tests/ui/used_underscore_binding.stderr index 6cbc328aa02..68e96148093 100644 --- a/tests/ui/used_underscore_binding.stderr +++ b/tests/ui/used_underscore_binding.stderr @@ -30,5 +30,11 @@ error: used binding `_underscore_field` which is prefixed with an underscore. A LL | s._underscore_field += 1; | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error: used binding `_i` which is prefixed with an underscore. A leading underscore signals that a binding will not be used. + --> $DIR/used_underscore_binding.rs:100:16 + | +LL | uses_i(_i); + | ^^ + +error: aborting due to 6 previous errors |
