@@ -260,6 +260,38 @@ struct Foo { x: bool }
260260
261261struct Bar<S, T> { x: Foo<S, T> }
262262```
263+ "## ,
264+
265+ E0249 : r##"
266+ This error indicates a constant expression for the array length was found, but
267+ it was not an integer (signed or unsigned) expression.
268+
269+ Some examples of code that produces this error are:
270+
271+ ```
272+ const A: [u32; "hello"] = []; // error
273+ const B: [u32; true] = []; // error
274+ const C: [u32; 0.0] = []; // error
275+ "## ,
276+
277+ E0250 : r##"
278+ This means there was an error while evaluating the expression for the length of
279+ a fixed-size array type.
280+
281+ Some examples of code that produces this error are:
282+
283+ ```
284+ // divide by zero in the length expression
285+ const A: [u32; 1/0] = [];
286+
287+ // Rust currently will not evaluate the function `foo` at compile time
288+ fn foo() -> usize { 12 }
289+ const B: [u32; foo()] = [];
290+
291+ // it is an error to try to add `u8` and `f64`
292+ use std::{f64, u8};
293+ const C: [u32; u8::MAX + f64::EPSILON] = [];
294+ ```
263295"##
264296
265297}
@@ -403,8 +435,6 @@ register_diagnostics! {
403435 E0246 , // illegal recursive type
404436 E0247 , // found module name used as a type
405437 E0248 , // found value name used as a type
406- E0249 , // expected constant expr for array length
407- E0250 , // expected constant expr for array length
408438 E0318 , // can't create default impls for traits outside their crates
409439 E0319 , // trait impls for defaulted traits allowed just for structs/enums
410440 E0320 , // recursive overflow during dropck
0 commit comments