Skip to content

Commit 9bda9ac

Browse files
Relax validation now
1 parent b7d67ea commit 9bda9ac

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

compiler/rustc_const_eval/src/transform/validate.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,13 @@ impl<'tcx> MirPass<'tcx> for Validator {
105105
&& let Some(by_move_body) = body.coroutine_by_move_body()
106106
&& let Some(by_move_layout) = by_move_body.coroutine_layout_raw()
107107
{
108-
if layout != by_move_layout {
109-
// If this turns out not to be true, please let compiler-errors know.
110-
// It is possible to support, but requires some changes to the layout
111-
// computation code.
108+
// FIXME(async_closures): We could do other validation here?
109+
if layout.variant_fields.len() != by_move_layout.variant_fields.len() {
112110
cfg_checker.fail(
113111
Location::START,
114112
format!(
115-
"Coroutine layout differs from by-move coroutine layout:\n\
113+
"Coroutine layout has different number of variant fields from \
114+
by-move coroutine layout:\n\
116115
layout: {layout:#?}\n\
117116
by_move_layout: {by_move_layout:#?}",
118117
),

compiler/rustc_middle/src/ty/sty.rs

-2
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,6 @@ impl<'tcx> CoroutineArgs<'tcx> {
694694
#[inline]
695695
pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'tcx>) -> Range<VariantIdx> {
696696
// FIXME requires optimized MIR
697-
// FIXME(async_closures): We should assert all coroutine layouts have
698-
// the same number of variants.
699697
FIRST_VARIANT
700698
..tcx.coroutine_layout(def_id, tcx.types.unit).unwrap().variant_fields.next_index()
701699
}

0 commit comments

Comments
 (0)