about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-12-21 18:49:20 +0000
committerMichael Goulet <michael@errs.io>2023-12-22 23:58:29 +0000
commit004450506e1302239fa9ea09d50d9dc5a3261a32 (patch)
tree1eeff59a02cdb0512f147a06514b756c57208f25 /compiler/rustc_ty_utils/src
parentd6d7a93866f2ffcfb51828b8859bdad760b54ce0 (diff)
downloadrust-004450506e1302239fa9ea09d50d9dc5a3261a32.tar.gz
rust-004450506e1302239fa9ea09d50d9dc5a3261a32.zip
Split coroutine desugaring kind from source
Diffstat (limited to 'compiler/rustc_ty_utils/src')
-rw-r--r--compiler/rustc_ty_utils/src/abi.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index a5f11ca23e1..86501b5a72d 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -114,13 +114,13 @@ fn fn_sig_for_fn_abi<'tcx>(
             let pin_adt_ref = tcx.adt_def(pin_did);
             let pin_args = tcx.mk_args(&[env_ty.into()]);
             let env_ty = match coroutine_kind {
-                hir::CoroutineKind::Gen(_) => {
+                hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _) => {
                     // Iterator::next doesn't accept a pinned argument,
                     // unlike for all other coroutine kinds.
                     env_ty
                 }
-                hir::CoroutineKind::Async(_)
-                | hir::CoroutineKind::AsyncGen(_)
+                hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _)
+                | hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::AsyncGen, _)
                 | hir::CoroutineKind::Coroutine => Ty::new_adt(tcx, pin_adt_ref, pin_args),
             };
 
@@ -131,7 +131,7 @@ fn fn_sig_for_fn_abi<'tcx>(
             // or the `Iterator::next(...) -> Option` function in case this is a
             // special coroutine backing a gen construct.
             let (resume_ty, ret_ty) = match coroutine_kind {
-                hir::CoroutineKind::Async(_) => {
+                hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _) => {
                     // The signature should be `Future::poll(_, &mut Context<'_>) -> Poll<Output>`
                     assert_eq!(sig.yield_ty, tcx.types.unit);
 
@@ -156,7 +156,7 @@ fn fn_sig_for_fn_abi<'tcx>(
 
                     (Some(context_mut_ref), ret_ty)
                 }
-                hir::CoroutineKind::Gen(_) => {
+                hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _) => {
                     // The signature should be `Iterator::next(_) -> Option<Yield>`
                     let option_did = tcx.require_lang_item(LangItem::Option, None);
                     let option_adt_ref = tcx.adt_def(option_did);
@@ -168,7 +168,7 @@ fn fn_sig_for_fn_abi<'tcx>(
 
                     (None, ret_ty)
                 }
-                hir::CoroutineKind::AsyncGen(_) => {
+                hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::AsyncGen, _) => {
                     // The signature should be
                     // `AsyncIterator::poll_next(_, &mut Context<'_>) -> Poll<Option<Output>>`
                     assert_eq!(sig.return_ty, tcx.types.unit);