summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/issue-91560.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/issue-91560.fixed')
-rw-r--r--src/test/ui/consts/issue-91560.fixed21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-91560.fixed b/src/test/ui/consts/issue-91560.fixed
new file mode 100644
index 000000000..41b9d9573
--- /dev/null
+++ b/src/test/ui/consts/issue-91560.fixed
@@ -0,0 +1,21 @@
+// Regression test for issue #91560.
+
+// run-rustfix
+
+#![allow(unused,non_upper_case_globals)]
+
+fn foo() {
+ const length: usize = 2;
+ //~^ HELP: consider using `const`
+ let arr = [0; length];
+ //~^ ERROR: attempt to use a non-constant value in a constant [E0435]
+}
+
+fn bar() {
+ const length: usize = 2;
+ //~^ HELP: consider using `const`
+ let arr = [0; length];
+ //~^ ERROR: attempt to use a non-constant value in a constant [E0435]
+}
+
+fn main() {}