mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Consider synthetic closure bodies to be typeck children
This commit is contained in:
parent
5fe0e40e05
commit
63405fc2b3
@ -571,7 +571,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
/// Returns `true` if `def_id` refers to a definition that does not have its own
|
||||
/// type-checking context, i.e. closure, coroutine or inline const.
|
||||
pub fn is_typeck_child(self, def_id: DefId) -> bool {
|
||||
matches!(self.def_kind(def_id), DefKind::Closure | DefKind::InlineConst)
|
||||
matches!(
|
||||
self.def_kind(def_id),
|
||||
DefKind::Closure | DefKind::InlineConst | DefKind::SyntheticCoroutineBody
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns `true` if `def_id` refers to a trait (i.e., `trait Foo { ... }`).
|
||||
|
@ -0,0 +1,19 @@
|
||||
//@ aux-build:block-on.rs
|
||||
//@ edition: 2021
|
||||
//@ build-pass
|
||||
//@ compile-flags: -Cdebuginfo=2
|
||||
|
||||
#![feature(async_closure)]
|
||||
|
||||
extern crate block_on;
|
||||
|
||||
async fn call_once(f: impl async FnOnce()) {
|
||||
f().await;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
block_on::block_on(async {
|
||||
let async_closure = async move || {};
|
||||
call_once(async_closure).await;
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user