diff options
Diffstat (limited to 'tests/ui/consts/const-len-underflow-separate-spans.rs')
-rw-r--r-- | tests/ui/consts/const-len-underflow-separate-spans.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/consts/const-len-underflow-separate-spans.rs b/tests/ui/consts/const-len-underflow-separate-spans.rs new file mode 100644 index 000000000..4544c8876 --- /dev/null +++ b/tests/ui/consts/const-len-underflow-separate-spans.rs @@ -0,0 +1,13 @@ +// Check that a constant-evaluation underflow highlights the correct +// spot (where the underflow occurred), while also providing the +// overall context for what caused the evaluation. + +const ONE: usize = 1; +const TWO: usize = 2; +const LEN: usize = ONE - TWO; +//~^ ERROR constant + +fn main() { + let a: [i8; LEN] = unimplemented!(); +//~^ constant +} |