about summary refs log tree commit diff
path: root/compiler/rustc_hir/src
diff options
context:
space:
mode:
authorDaria Sukhonina <dariasukhonina@gmail.com>2025-09-08 14:32:26 +0300
committerDaria Sukhonina <dariasukhonina@gmail.com>2025-09-08 14:50:23 +0300
commit78718d55700865328d1abf584956125bec7f5d9d (patch)
tree1f906a8705d8b82faa6b154a4f811832a3db63ef /compiler/rustc_hir/src
parentbeeb8e3af54295ba494c250e84ecda4c2c5d85ff (diff)
downloadrust-78718d55700865328d1abf584956125bec7f5d9d.tar.gz
rust-78718d55700865328d1abf584956125bec7f5d9d.zip
Skip typeck for items w/o their own typeck context
More details on about this fix:

https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/ICE.3A.20typecks.20AnonConst.20under.20parallel.20rustc.28.23141951.29/with/538200980

Co-authored-by: ywxt <ywxtcwh@gmail.com>
Diffstat (limited to 'compiler/rustc_hir/src')
-rw-r--r--compiler/rustc_hir/src/def.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs
index 8af4740f376..d563fd0a547 100644
--- a/compiler/rustc_hir/src/def.rs
+++ b/compiler/rustc_hir/src/def.rs
@@ -440,6 +440,13 @@ impl DefKind {
             | DefKind::ExternCrate => false,
         }
     }
+
+    /// Returns `true` if `self` is a kind of definition that does not have its own
+    /// type-checking context, i.e. closure, coroutine or inline const.
+    #[inline]
+    pub fn is_typeck_child(self) -> bool {
+        matches!(self, DefKind::Closure | DefKind::InlineConst | DefKind::SyntheticCoroutineBody)
+    }
 }
 
 /// The resolution of a path or export.