From 63405fc2b3a15194e47712b738275c6d76de6b27 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 14 Sep 2024 16:33:25 -0400 Subject: Consider synthetic closure bodies to be typeck children --- compiler/rustc_middle/src/ty/util.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_middle/src/ty/util.rs') diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index d70ff8258d0..a0262f12cb5 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -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 { ... }`). -- cgit 1.4.1-3-g733a5