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

@ -16,7 +16,8 @@ const FOO: [u32; 3] = [1, 2, 3];
const BAR: u32 = FOO[5]; // no error, because the error below occurs before regular const eval
const BLUB: [u32; FOO[4]] = [5, 6];
//~^ ERROR array length constant evaluation error: index out of bounds: the len is 3 but the index is 4 [E0250]
//~^ ERROR constant evaluation error [E0080]
//~| index out of bounds: the len is 3 but the index is 4
fn main() {
let _ = BAR;