-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the coroutine def id of an async closure the child of the closur…
…e def id
- Loading branch information
1 parent
6b4f1c5
commit 5d8c178
Showing
3 changed files
with
43 additions
and
6 deletions.
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,14 @@ | ||
// compile-flags: -Zverbose-internals | ||
// edition:2021 | ||
|
||
#![feature(async_closure)] | ||
|
||
fn main() { | ||
let x = async || {}; | ||
//~^ NOTE the expected `async` closure body | ||
let () = x(); | ||
//~^ ERROR mismatched types | ||
//~| NOTE this expression has type `{static main::{closure#0}::{closure#0} upvar_tys= | ||
//~| NOTE expected `async` closure body, found `()` | ||
//~| NOTE expected `async` closure body `{static main::{closure#0}::{closure#0} | ||
} |
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 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/def-path.rs:9:9 | ||
| | ||
LL | let x = async || {}; | ||
| -- the expected `async` closure body | ||
LL | | ||
LL | let () = x(); | ||
| ^^ --- this expression has type `{static main::{closure#0}::{closure#0} upvar_tys=?7t witness=?8t}` | ||
| | | ||
| expected `async` closure body, found `()` | ||
| | ||
= note: expected `async` closure body `{static main::{closure#0}::{closure#0} upvar_tys=?7t witness=?8t}` | ||
found unit type `()` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |