]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0435.md
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
[rust.git] / src / librustc_error_codes / error_codes / E0435.md
1 A non-constant value was used in a constant expression.
2
3 Erroneous code example:
4
5 ```compile_fail,E0435
6 let foo = 42;
7 let a: [u8; foo]; // error: attempt to use a non-constant value in a constant
8 ```
9
10 To fix this error, please replace the value with a constant. Example:
11
12 ```
13 let a: [u8; 42]; // ok!
14 ```
15
16 Or:
17
18 ```
19 const FOO: usize = 42;
20 let a: [u8; FOO]; // ok!
21 ```