Skip to content

Commit

Permalink
Rollup merge of #88691 - hyd-dev:88649, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Add a regression test for #88649

I noticed that #88649 does not have a regression test, so I add one in this PR.

The test fails with this without #88678:
```
error[E0080]: evaluation of constant value failed
  --> /checkout/src/test/ui/consts/issue-88649.rs:13:52
   |
LL |             Foo::Variant1(x) | Foo::Variant2(x) if x => {}
   |                                                    ^ StorageLive on a local that was already live

error: aborting due to previous error

For more information about this error, try `rustc --explain E0080`.
```
  • Loading branch information
jackh726 committed Sep 8, 2021
2 parents 2bbcf92 + 214eef0 commit f69ccb1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/ui/consts/issue-88649.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// check-pass
#![crate_type = "lib"]

enum Foo {
Variant1(bool),
Variant2(bool),
}

const _: () = {
let mut n = 0;
while n < 2 {
match Foo::Variant1(true) {
Foo::Variant1(x) | Foo::Variant2(x) if x => {}
_ => {}
}
n += 1;
}
};

0 comments on commit f69ccb1

Please sign in to comment.