Relax validation now
This commit is contained in:
parent
b7d67eace7
commit
9bda9ac76e
2 changed files with 4 additions and 7 deletions
|
@ -105,14 +105,13 @@ impl<'tcx> MirPass<'tcx> for Validator {
|
||||||
&& let Some(by_move_body) = body.coroutine_by_move_body()
|
&& let Some(by_move_body) = body.coroutine_by_move_body()
|
||||||
&& let Some(by_move_layout) = by_move_body.coroutine_layout_raw()
|
&& let Some(by_move_layout) = by_move_body.coroutine_layout_raw()
|
||||||
{
|
{
|
||||||
if layout != by_move_layout {
|
// FIXME(async_closures): We could do other validation here?
|
||||||
// If this turns out not to be true, please let compiler-errors know.
|
if layout.variant_fields.len() != by_move_layout.variant_fields.len() {
|
||||||
// It is possible to support, but requires some changes to the layout
|
|
||||||
// computation code.
|
|
||||||
cfg_checker.fail(
|
cfg_checker.fail(
|
||||||
Location::START,
|
Location::START,
|
||||||
format!(
|
format!(
|
||||||
"Coroutine layout differs from by-move coroutine layout:\n\
|
"Coroutine layout has different number of variant fields from \
|
||||||
|
by-move coroutine layout:\n\
|
||||||
layout: {layout:#?}\n\
|
layout: {layout:#?}\n\
|
||||||
by_move_layout: {by_move_layout:#?}",
|
by_move_layout: {by_move_layout:#?}",
|
||||||
),
|
),
|
||||||
|
|
|
@ -694,8 +694,6 @@ impl<'tcx> CoroutineArgs<'tcx> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'tcx>) -> Range<VariantIdx> {
|
pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'tcx>) -> Range<VariantIdx> {
|
||||||
// FIXME requires optimized MIR
|
// FIXME requires optimized MIR
|
||||||
// FIXME(async_closures): We should assert all coroutine layouts have
|
|
||||||
// the same number of variants.
|
|
||||||
FIRST_VARIANT
|
FIRST_VARIANT
|
||||||
..tcx.coroutine_layout(def_id, tcx.types.unit).unwrap().variant_fields.next_index()
|
..tcx.coroutine_layout(def_id, tcx.types.unit).unwrap().variant_fields.next_index()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue