about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/context.rs
diff options
context:
space:
mode:
authorbohan <bohan-zhang@foxmail.com>2023-11-26 21:05:08 +0800
committerbohan <bohan-zhang@foxmail.com>2023-11-26 21:05:08 +0800
commitf23befe6c118573a2ca041bc89f959a8813b43a2 (patch)
treedc0185a1375a527e7112b07412295916683cff7e /compiler/rustc_middle/src/ty/context.rs
parent274b5249eb1014b441fd9fe45e9373111f61e413 (diff)
downloadrust-f23befe6c118573a2ca041bc89f959a8813b43a2.tar.gz
rust-f23befe6c118573a2ca041bc89f959a8813b43a2.zip
merge `DefKind::Coroutine` into `DefKind::Closure`
Diffstat (limited to 'compiler/rustc_middle/src/ty/context.rs')
-rw-r--r--compiler/rustc_middle/src/ty/context.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 3e24b7cce86..22117d63e03 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -800,6 +800,10 @@ impl<'tcx> TyCtxt<'tcx> {
         self.diagnostic_items(did.krate).name_to_id.get(&name) == Some(&did)
     }
 
+    pub fn is_coroutine(self, def_id: DefId) -> bool {
+        self.coroutine_kind(def_id).is_some()
+    }
+
     /// Returns `true` if the node pointed to by `def_id` is a coroutine for an async construct.
     pub fn coroutine_is_async(self, def_id: DefId) -> bool {
         matches!(self.coroutine_kind(def_id), Some(hir::CoroutineKind::Async(_)))