blob: 55aee7336da32afd2cfd52d96e0d99e5dfa28ef0 (
plain)
1
2
3
4
5
6
7
8
9
10
|
//! Arrays created with `[value; length]` syntax need the length to be known at
//! compile time. This test makes sure the compiler rejects runtime values like
//! function parameters in the length position.
fn main() {
fn create_array(n: usize) {
let _x = [0; n];
//~^ ERROR attempt to use a non-constant value in a constant [E0435]
}
}
|