about summary refs log tree commit diff
path: root/src/test/ui/array-slice-vec/suggest-array-length.fixed
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-16 05:13:38 +0000
committerbors <bors@rust-lang.org>2022-08-16 05:13:38 +0000
commit8556e6620e4866526b3cea767ad8c20ae877a569 (patch)
tree13d9f9ec09bd402a73d9e1e01f5b6bef7f486544 /src/test/ui/array-slice-vec/suggest-array-length.fixed
parentef9810a3e2a9a16e79176cb0d3466ea82d239942 (diff)
parent88af506e948d3a5e1aca5fe68a2d926d7cabefdd (diff)
downloadrust-8556e6620e4866526b3cea767ad8c20ae877a569.tar.gz
rust-8556e6620e4866526b3cea767ad8c20ae877a569.zip
Auto merge of #100611 - matthiaskrgr:rollup-rxj10ur, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #100338 (when there are 3 or more return statements in the loop)
 - #100384 (Add support for generating unique profraw files by default when using `-C instrument-coverage`)
 - #100460 (Update the minimum external LLVM to 13)
 - #100567 (Add missing closing quote)
 - #100590 (Suggest adding an array length if possible)
 - #100600 (Rename Machine memory hooks to suggest when they run)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui/array-slice-vec/suggest-array-length.fixed')
-rw-r--r--src/test/ui/array-slice-vec/suggest-array-length.fixed14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/suggest-array-length.fixed b/src/test/ui/array-slice-vec/suggest-array-length.fixed
new file mode 100644
index 00000000000..bae3ab74af6
--- /dev/null
+++ b/src/test/ui/array-slice-vec/suggest-array-length.fixed
@@ -0,0 +1,14 @@
+// run-rustfix
+#![allow(unused_variables, dead_code, non_upper_case_globals)]
+
+fn main() {
+    const Foo: [i32; 3] = [1, 2, 3];
+    //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
+    //~| ERROR using `_` for array lengths is unstable
+    let foo: [i32; 3] = [1, 2, 3];
+    //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
+    //~| ERROR using `_` for array lengths is unstable
+    let bar: [i32; 3] = [0; 3];
+    //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment
+    //~| ERROR using `_` for array lengths is unstable
+}