forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#62383 - Aaron1011:fix/async-error-span, r=v…
…arkor Improve error span for async type inference error Fixes rust-lang#62382 Previously, we would point at the spawn of the 'await' expression, instead of the actual expression with an unknown type.
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |