Implement async gen
blocks
This commit is contained in:
parent
a0cbc168c9
commit
96bb542a31
32 changed files with 563 additions and 54 deletions
|
@ -271,6 +271,21 @@ fn resolve_associated_item<'tcx>(
|
|||
debug_assert!(tcx.defaultness(trait_item_id).has_value());
|
||||
Some(Instance::new(trait_item_id, rcvr_args))
|
||||
}
|
||||
} else if Some(trait_ref.def_id) == lang_items.async_iterator_trait() {
|
||||
let ty::Coroutine(coroutine_def_id, args, _) = *rcvr_args.type_at(0).kind() else {
|
||||
bug!()
|
||||
};
|
||||
|
||||
if cfg!(debug_assertions) && tcx.item_name(trait_item_id) != sym::poll_next {
|
||||
span_bug!(
|
||||
tcx.def_span(coroutine_def_id),
|
||||
"no definition for `{trait_ref}::{}` for built-in coroutine type",
|
||||
tcx.item_name(trait_item_id)
|
||||
)
|
||||
}
|
||||
|
||||
// `AsyncIterator::poll_next` is generated by the compiler.
|
||||
Some(Instance { def: ty::InstanceDef::Item(coroutine_def_id), args })
|
||||
} else if Some(trait_ref.def_id) == lang_items.coroutine_trait() {
|
||||
let ty::Coroutine(coroutine_def_id, args, _) = *rcvr_args.type_at(0).kind() else {
|
||||
bug!()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue