-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't call closure_by_move_body_def_id on FnOnce async closures in MI…
…R validation
- Loading branch information
1 parent
f827364
commit 5cf117e
Showing
5 changed files
with
24 additions
and
8 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
20 changes: 20 additions & 0 deletions
20
tests/ui/async-await/async-closures/body-check-on-non-fnmut.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,20 @@ | ||
//@ aux-build:block-on.rs | ||
//@ edition:2021 | ||
//@ build-pass | ||
|
||
#![feature(async_closure)] | ||
|
||
extern crate block_on; | ||
|
||
// Make sure that we don't call `coroutine_by_move_body_def_id` query | ||
// on async closures that are `FnOnce`. See issue: #130167. | ||
|
||
async fn empty() {} | ||
|
||
pub async fn call_once<F: async FnOnce()>(f: F) { | ||
f().await; | ||
} | ||
|
||
fn main() { | ||
block_on::block_on(call_once(async || empty().await)); | ||
} |