Skip to content

Commit 40a0fdc

Browse files
committed
Add regression test for #66706
1 parent 3b1d735 commit 40a0fdc

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

src/test/ui/issues/issue-66706.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
fn a() {
2+
[0; [|_: _ &_| ()].len()]
3+
//~^ ERROR expected `,`, found `&`
4+
//~| ERROR type annotations needed
5+
//~| ERROR mismatched types
6+
}
7+
8+
fn b() {
9+
[0; [|f @ &ref _| {} ; 0 ].len() ];
10+
//~^ ERROR expected identifier, found reserved identifier `_`
11+
}
12+
13+
fn main() {}

src/test/ui/issues/issue-66706.stderr

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
error: expected `,`, found `&`
2+
--> $DIR/issue-66706.rs:2:16
3+
|
4+
LL | [0; [|_: _ &_| ()].len()]
5+
| -^ expected `,`
6+
| |
7+
| help: missing `,`
8+
9+
error: expected identifier, found reserved identifier `_`
10+
--> $DIR/issue-66706.rs:9:20
11+
|
12+
LL | [0; [|f @ &ref _| {} ; 0 ].len() ];
13+
| ^ expected identifier, found reserved identifier
14+
15+
error[E0282]: type annotations needed
16+
--> $DIR/issue-66706.rs:2:11
17+
|
18+
LL | [0; [|_: _ &_| ()].len()]
19+
| ^ consider giving this closure parameter a type
20+
21+
error[E0308]: mismatched types
22+
--> $DIR/issue-66706.rs:2:5
23+
|
24+
LL | fn a() {
25+
| - help: try adding a return type: `-> [{integer}; _]`
26+
LL | [0; [|_: _ &_| ()].len()]
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[{integer}; _]`
28+
29+
error: aborting due to 4 previous errors
30+
31+
Some errors have detailed explanations: E0282, E0308.
32+
For more information about an error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)