1
Fork 0

refactor constant evaluation error reporting

Refactor constant evaluation to use a single error reporting function
that reports a type-error-like message.

Also, unify all error codes with the "constant evaluation error" message
to just E0080, and similarly for a few other duplicate codes. The old
situation was a total mess, and now that we have *something* we can
further iterate on the UX.
This commit is contained in:
Ariel Ben-Yehuda 2016-07-20 00:02:56 +03:00
parent fa4eda8935
commit 37c569627c
55 changed files with 506 additions and 376 deletions

View file

@ -20,9 +20,10 @@ use std::{u8, u16, u32, u64, usize};
const A_I8_T
: [u32; (i8::MAX as i8 + 1u8) as usize]
//~^ ERROR mismatched types:
//~| expected `i8`,
//~| found `u8` [E0250]
//~^ ERROR constant evaluation error [E0080]
//~| mismatched types
//~| expected `i8`
//~| found `u8`
= [0; (i8::MAX as usize) + 1];
@ -33,7 +34,8 @@ const A_CHAR_USIZE
const A_BAD_CHAR_USIZE
: [u32; 5i8 as char as usize]
//~^ ERROR only `u8` can be cast as `char`, not `i8`
//~^ ERROR constant evaluation error
//~| only `u8` can be cast as `char`, not `i8`
= [0; 5];
fn main() {}