-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
{async closure}: Fn
in new solver
- Loading branch information
1 parent
fc3800f
commit 102b458
Showing
3 changed files
with
101 additions
and
3 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,24 @@ | ||
//@ aux-build:block-on.rs | ||
//@ edition:2021 | ||
//@ build-pass | ||
//@ revisions: current next | ||
//@[next] compile-flags: -Znext-solver | ||
|
||
#![feature(async_closure)] | ||
|
||
use std::future::Future; | ||
|
||
extern crate block_on; | ||
|
||
// Check that closures that don't capture any state may implement `Fn`. | ||
|
||
fn main() { | ||
block_on::block_on(async { | ||
async fn call_once<F: Future>(x: impl FnOnce(&'static str) -> F) -> F::Output { | ||
x("hello, world").await | ||
} | ||
call_once(async |x: &'static str| { | ||
println!("hello, {x}"); | ||
}).await | ||
}); | ||
} |
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