File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ // Checks that the compiler complains about the missing closure body and does not
2+ // crash.
3+ // This is a regression test for <https://github.com/rust-lang/rust/issues/143128>.
4+
5+ fn main ( ) { | b : [ str ; _] | }
6+ //~^ ERROR expected expression, found `}`
7+ //~| ERROR the placeholder `_` is not allowed within types on item signatures for closures
8+ //~| ERROR the size for values of type `str` cannot be known at compilation time
Original file line number Diff line number Diff line change 1+ error: expected expression, found `}`
2+ --> $DIR/missing-body.rs:5:30
3+ |
4+ LL | fn main() { | b : [str; _] | }
5+ | ---------------- ^ expected expression
6+ | |
7+ | while parsing the body of this closure
8+ |
9+ help: you might have meant to open the body of the closure, instead of enclosing the closure in a block
10+ |
11+ LL - fn main() { | b : [str; _] | }
12+ LL + fn main() | b : [str; _] | { }
13+ |
14+
15+ error[E0121]: the placeholder `_` is not allowed within types on item signatures for closures
16+ --> $DIR/missing-body.rs:5:25
17+ |
18+ LL | fn main() { | b : [str; _] | }
19+ | ^ not allowed in type signatures
20+
21+ error[E0277]: the size for values of type `str` cannot be known at compilation time
22+ --> $DIR/missing-body.rs:5:19
23+ |
24+ LL | fn main() { | b : [str; _] | }
25+ | ^^^^^^^^ doesn't have a size known at compile-time
26+ |
27+ = help: the trait `Sized` is not implemented for `str`
28+ = note: slice and array elements must have `Sized` type
29+
30+ error: aborting due to 3 previous errors
31+
32+ Some errors have detailed explanations: E0121, E0277.
33+ For more information about an error, try `rustc --explain E0121`.
You can’t perform that action at this time.
0 commit comments