about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Macleod <alex@macleod.io>2020-03-26 16:10:58 +0000
committerAlex Macleod <alex@macleod.io>2020-03-26 16:33:18 +0000
commit40a0fdcb1840b01c5ac2c58b48df0ed5bc33a7af (patch)
tree09021a4085644484b7614bf39df23ac06906e940 /src
parent3b1d7351186a073c72e4be3c7d7b7ab8f1f10c58 (diff)
Add regression test for #66706
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/issues/issue-66706.rs13
-rw-r--r--src/test/ui/issues/issue-66706.stderr32
2 files changed, 45 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-66706.rs b/src/test/ui/issues/issue-66706.rs
new file mode 100644
index 00000000000..5e64f63d533
--- /dev/null
+++ b/src/test/ui/issues/issue-66706.rs
@@ -0,0 +1,13 @@
+fn a() {
+    [0; [|_: _ &_| ()].len()]
+    //~^ ERROR expected `,`, found `&`
+    //~| ERROR type annotations needed
+    //~| ERROR mismatched types
+}
+
+fn b() {
+    [0; [|f @ &ref _| {} ; 0 ].len() ];
+    //~^ ERROR expected identifier, found reserved identifier `_`
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-66706.stderr b/src/test/ui/issues/issue-66706.stderr
new file mode 100644
index 00000000000..6d290bccc7d
--- /dev/null
+++ b/src/test/ui/issues/issue-66706.stderr
@@ -0,0 +1,32 @@
+error: expected `,`, found `&`
+  --> $DIR/issue-66706.rs:2:16
+   |
+LL |     [0; [|_: _ &_| ()].len()]
+   |               -^ expected `,`
+   |               |
+   |               help: missing `,`
+
+error: expected identifier, found reserved identifier `_`
+  --> $DIR/issue-66706.rs:9:20
+   |
+LL |     [0; [|f @ &ref _| {} ; 0 ].len() ];
+   |                    ^ expected identifier, found reserved identifier
+
+error[E0282]: type annotations needed
+  --> $DIR/issue-66706.rs:2:11
+   |
+LL |     [0; [|_: _ &_| ()].len()]
+   |           ^ consider giving this closure parameter a type
+
+error[E0308]: mismatched types
+  --> $DIR/issue-66706.rs:2:5
+   |
+LL | fn a() {
+   |        - help: try adding a return type: `-> [{integer}; _]`
+LL |     [0; [|_: _ &_| ()].len()]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[{integer}; _]`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0282, E0308.
+For more information about an error, try `rustc --explain E0282`.