about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-03-24 21:14:49 -0400
committerMichael Goulet <michael@errs.io>2024-03-24 21:15:23 -0400
commit9bda9ac76e8d232c6cf0efde55dace718c1d428c (patch)
tree3e1a604e8e95700319ba46d0407fc696294a0a1c
parentb7d67eace78d5e660df93b513326650fe8226a96 (diff)
downloadrust-9bda9ac76e8d232c6cf0efde55dace718c1d428c.tar.gz
rust-9bda9ac76e8d232c6cf0efde55dace718c1d428c.zip
Relax validation now
-rw-r--r--compiler/rustc_const_eval/src/transform/validate.rs9
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs2
2 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs
index b085e4e76a1..378b168a50c 100644
--- a/compiler/rustc_const_eval/src/transform/validate.rs
+++ b/compiler/rustc_const_eval/src/transform/validate.rs
@@ -105,14 +105,13 @@ impl<'tcx> MirPass<'tcx> for Validator {
             && let Some(by_move_body) = body.coroutine_by_move_body()
             && let Some(by_move_layout) = by_move_body.coroutine_layout_raw()
         {
-            if layout != by_move_layout {
-                // If this turns out not to be true, please let compiler-errors know.
-                // It is possible to support, but requires some changes to the layout
-                // computation code.
+            // FIXME(async_closures): We could do other validation here?
+            if layout.variant_fields.len() != by_move_layout.variant_fields.len() {
                 cfg_checker.fail(
                     Location::START,
                     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\
                         by_move_layout: {by_move_layout:#?}",
                     ),
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index 82a2423cbc6..510a4b59520 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -694,8 +694,6 @@ impl<'tcx> CoroutineArgs<'tcx> {
     #[inline]
     pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'tcx>) -> Range<VariantIdx> {
         // FIXME requires optimized MIR
-        // FIXME(async_closures): We should assert all coroutine layouts have
-        // the same number of variants.
         FIRST_VARIANT
             ..tcx.coroutine_layout(def_id, tcx.types.unit).unwrap().variant_fields.next_index()
     }