Skip to content

Commit 3d59877

Browse files
Add regression test for #143128
1 parent a86b331 commit 3d59877

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/ui/closures/missing-body.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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 the placeholder `_` is not allowed within types on item signatures for closures
7+
//~| ERROR the size for values of type `str` cannot be known at compilation time

tests/ui/closures/missing-body.stderr

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for closures
2+
--> $DIR/missing-body.rs:5:23
3+
|
4+
LL | fn main() { |b: [str; _]| {}; }
5+
| ^ not allowed in type signatures
6+
7+
error[E0277]: the size for values of type `str` cannot be known at compilation time
8+
--> $DIR/missing-body.rs:5:17
9+
|
10+
LL | fn main() { |b: [str; _]| {}; }
11+
| ^^^^^^^^ doesn't have a size known at compile-time
12+
|
13+
= help: the trait `Sized` is not implemented for `str`
14+
= note: slice and array elements must have `Sized` type
15+
16+
error: aborting due to 2 previous errors
17+
18+
Some errors have detailed explanations: E0121, E0277.
19+
For more information about an error, try `rustc --explain E0121`.

0 commit comments

Comments
 (0)