-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a couple more DefKind discrepancies between DefKind::Closure and …
…DefKind::SyntheticCoroutineBody
- Loading branch information
1 parent
af1ca77
commit 5c374a4
Showing
4 changed files
with
44 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
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,34 @@ | ||
//@ edition: 2021 | ||
//@ compile-flags: -Zinline-mir | ||
//@ build-pass | ||
|
||
// Ensure that we don't hit a Steal ICE because we forgot to ensure | ||
// `mir_inliner_callees` for the synthetic by-move coroutine body since | ||
// its def-id wasn't previously being considered. | ||
|
||
#![feature(async_closure, noop_waker)] | ||
|
||
use std::future::Future; | ||
use std::pin::pin; | ||
use std::task::*; | ||
|
||
pub fn block_on<T>(fut: impl Future<Output = T>) -> T { | ||
let mut fut = pin!(fut); | ||
let ctx = &mut Context::from_waker(Waker::noop()); | ||
|
||
loop { | ||
match fut.as_mut().poll(ctx) { | ||
Poll::Pending => {} | ||
Poll::Ready(t) => break t, | ||
} | ||
} | ||
} | ||
|
||
async fn call_once<T>(f: impl async FnOnce() -> T) -> T { | ||
f().await | ||
} | ||
|
||
fn main() { | ||
let c = async || {}; | ||
block_on::block_on(call_once(c)); | ||
} |