diff options
| author | Ayaz Hafiz <ayaz.hafiz.1@gmail.com> | 2020-06-06 11:44:28 -0700 |
|---|---|---|
| committer | Ayaz Hafiz <ayaz.hafiz.1@gmail.com> | 2020-06-06 11:44:28 -0700 |
| commit | 568cc22c3d04338f3413af19332a1c31b44dbf77 (patch) | |
| tree | 039478b986cb200392ccc5537e63adda38a91057 | |
| parent | 118b50524b79e565f017e08bce9b90a16c63634f (diff) | |
| download | rust-568cc22c3d04338f3413af19332a1c31b44dbf77.tar.gz rust-568cc22c3d04338f3413af19332a1c31b44dbf77.zip | |
Add regression test for const generic ICE in #72819
Closes #72819
| -rw-r--r-- | src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.stderr | 10 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs new file mode 100644 index 00000000000..d9cbc815e8b --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.rs @@ -0,0 +1,16 @@ +#![feature(const_generics)] +#![allow(incomplete_features)] +struct Arr<const N: usize> +where Assert::<{N < usize::max_value() / 2}>: IsTrue, //~ ERROR constant expression depends on a generic parameter +{ +} + +enum Assert<const CHECK: bool> {} + +trait IsTrue {} + +impl IsTrue for Assert<true> {} + +fn main() { + let x: Arr<{usize::max_value()}> = Arr {}; +} diff --git a/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.stderr b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.stderr new file mode 100644 index 00000000000..f0b761f114b --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-72819-generic-in-const-eval.stderr @@ -0,0 +1,10 @@ +error: constant expression depends on a generic parameter + --> $DIR/issue-72819-generic-in-const-eval.rs:4:47 + | +LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue, + | ^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to previous error + |
