diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-05 13:53:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-05 13:53:11 +0200 |
| commit | cc696b957bfd74b1f642e0d509ca4bcba0b28953 (patch) | |
| tree | 27a1b79dd501776fd162eb146f85ad1e84acca41 /src/test | |
| parent | ccd925bc7d03f50f0eeadef4146130bafce921ab (diff) | |
| parent | 779308a5e123e9346ac0ac53771fa20240be2d5e (diff) | |
| download | rust-cc696b957bfd74b1f642e0d509ca4bcba0b28953.tar.gz rust-cc696b957bfd74b1f642e0d509ca4bcba0b28953.zip | |
Rollup merge of #62383 - Aaron1011:fix/async-error-span, r=varkor
Improve error span for async type inference error Fixes #62382 Previously, we would point at the spawn of the 'await' expression, instead of the actual expression with an unknown type.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/async-await/async-error-span.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/async-await/async-error-span.stderr | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/async-await/async-error-span.rs b/src/test/ui/async-await/async-error-span.rs new file mode 100644 index 00000000000..d362348a3fd --- /dev/null +++ b/src/test/ui/async-await/async-error-span.rs @@ -0,0 +1,17 @@ +// edition:2018 +#![feature(async_await)] + +// Regression test for issue #62382 + +use std::future::Future; + +fn get_future() -> impl Future<Output = ()> { + panic!() +} + +async fn foo() { + let a; //~ ERROR type inside `async` object must be known in this context + get_future().await; +} + +fn main() {} diff --git a/src/test/ui/async-await/async-error-span.stderr b/src/test/ui/async-await/async-error-span.stderr new file mode 100644 index 00000000000..bd8966b9c7d --- /dev/null +++ b/src/test/ui/async-await/async-error-span.stderr @@ -0,0 +1,15 @@ +error[E0698]: type inside `async` object must be known in this context + --> $DIR/async-error-span.rs:13:9 + | +LL | let a; + | ^ cannot infer type + | +note: the type is part of the `async` object because of this `await` + --> $DIR/async-error-span.rs:14:5 + | +LL | get_future().await; + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0698`. |
