mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-03 18:57:19 +00:00
11 lines
363 B
Rust
11 lines
363 B
Rust
//! 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]
|
|
}
|
|
}
|