forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't rely on upvars being assigned just because coroutine-closure ki…
…nd is assigned
- Loading branch information
1 parent
ab5bda1
commit 6f96d7d
Showing
6 changed files
with
75 additions
and
36 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
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
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
27 changes: 27 additions & 0 deletions
27
tests/ui/async-await/async-closures/constrained-but-no-upvars-yet.rs
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,27 @@ | ||
//@ edition: 2021 | ||
//@ check-pass | ||
//@ revisions: current next | ||
//@ ignore-compare-mode-next-solver (explicit revisions) | ||
//@[next] compile-flags: -Znext-solver | ||
|
||
#![feature(async_closure)] | ||
|
||
fn constrain<T: async FnOnce()>(t: T) -> T { | ||
t | ||
} | ||
|
||
fn call_once<T>(f: impl FnOnce() -> T) -> T { | ||
f() | ||
} | ||
|
||
async fn async_call_once<T>(f: impl async FnOnce() -> T) -> T { | ||
f().await | ||
} | ||
|
||
fn main() { | ||
let c = constrain(async || {}); | ||
call_once(c); | ||
|
||
let c = constrain(async || {}); | ||
async_call_once(c); | ||
} |