Add ui test for const evaluation fail when type is too big.
This commit is contained in:
parent
42b4b9c669
commit
3b2ff90529
2 changed files with 21 additions and 0 deletions
12
tests/ui/consts/const-eval-fail-too-big.rs
Normal file
12
tests/ui/consts/const-eval-fail-too-big.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
//Error output test for #78834: Type is too big for the target architecture
|
||||||
|
struct B<
|
||||||
|
A: Sized = [(); {
|
||||||
|
let x = [0u8; !0usize];
|
||||||
|
//~^ ERROR evaluation of constant value failed
|
||||||
|
1
|
||||||
|
}],
|
||||||
|
> {
|
||||||
|
a: A,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
9
tests/ui/consts/const-eval-fail-too-big.stderr
Normal file
9
tests/ui/consts/const-eval-fail-too-big.stderr
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
error[E0080]: evaluation of constant value failed
|
||||||
|
--> $DIR/const-eval-fail-too-big.rs:4:28
|
||||||
|
|
|
||||||
|
LL | let x = [0u8; !0usize];
|
||||||
|
| ^^^^^^^^^^^^^^ values of the type `[u8; usize::MAX]` are too big for the target architecture
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
Loading…
Add table
Add a link
Reference in a new issue