diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-06-30 00:05:58 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-07-01 15:16:56 +0500 |
| commit | da5c6395dad7c5be33f842c3660ae2f6af287f3a (patch) | |
| tree | ecdab72d5ce57382b83a6abcce3e2a693ba5a192 /tests/ui/consts/array-repeat-expr-not-const.rs | |
| parent | 4feb5de34c1e41da0c10e149e243a25a6eafcd17 (diff) | |
| download | rust-da5c6395dad7c5be33f842c3660ae2f6af287f3a.tar.gz rust-da5c6395dad7c5be33f842c3660ae2f6af287f3a.zip | |
cleaned up some tests
Diffstat (limited to 'tests/ui/consts/array-repeat-expr-not-const.rs')
| -rw-r--r-- | tests/ui/consts/array-repeat-expr-not-const.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/ui/consts/array-repeat-expr-not-const.rs b/tests/ui/consts/array-repeat-expr-not-const.rs index 1b101d3233f..55aee7336da 100644 --- a/tests/ui/consts/array-repeat-expr-not-const.rs +++ b/tests/ui/consts/array-repeat-expr-not-const.rs @@ -1,7 +1,9 @@ -// Check that non constant exprs fail for array repeat syntax +//! 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 bar(n: usize) { + fn create_array(n: usize) { let _x = [0; n]; //~^ ERROR attempt to use a non-constant value in a constant [E0435] } |
