From 3320c09eabb635fd6bf7a78a83a601a3d72193e8 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 25 Dec 2023 16:56:12 +0000 Subject: Only regular coroutines have movability --- .../rustc_const_eval/src/transform/check_consts/check.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_const_eval/src/transform') diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index bf7adf8f44c..0f2b4512fea 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -938,8 +938,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { TerminatorKind::InlineAsm { .. } => self.check_op(ops::InlineAsm), - TerminatorKind::CoroutineDrop | TerminatorKind::Yield { .. } => { - self.check_op(ops::Coroutine(hir::CoroutineKind::Coroutine)) + TerminatorKind::Yield { .. } => self.check_op(ops::Coroutine( + self.tcx + .coroutine_kind(self.body.source.def_id()) + .expect("Only expected to have a yield in a coroutine"), + )), + + TerminatorKind::CoroutineDrop => { + span_bug!( + self.body.source_info(location).span, + "We should not encounter TerminatorKind::CoroutineDrop after coroutine transform" + ); } TerminatorKind::UnwindTerminate(_) => { -- cgit 1.4.1-3-g733a5