about summary refs log tree commit diff
path: root/tests/ui/consts/array-repeat-expr-not-const.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/array-repeat-expr-not-const.rs')
-rw-r--r--tests/ui/consts/array-repeat-expr-not-const.rs6
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]
     }