]> git.lizzy.rs Git - rust.git/commitdiff
Change index for SwitchInt case
authorJonas Schievink <jonasschievink@gmail.com>
Sun, 8 Mar 2020 00:23:00 +0000 (01:23 +0100)
committerJonas Schievink <jonasschievink@gmail.com>
Sun, 8 Mar 2020 00:23:00 +0000 (01:23 +0100)
The indices do not matter here, and this fixes an index out of bounds
panic when compiling a generator that can unwind but not return.

src/librustc_mir/transform/generator.rs

index ffbf4ae939334f97c42bf0db43844350d0abf04a..841d18268b13af119f16c92032a92d8ca7400907 100644 (file)
@@ -1108,7 +1108,7 @@ fn create_generator_resume_function<'tcx>(
 
     if can_unwind {
         cases.insert(
-            2,
+            1,
             (POISONED, insert_panic_block(tcx, body, ResumedAfterPanic(generator_kind))),
         );
     }