Skip to content

Commit 93b7d8d

Browse files
Add test for APIT
1 parent 448c6a4 commit 93b7d8d

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
fn foo() {
2+
//~^ HELP try adding a return type
23
|x: &i32| 1i32
34
//~^ ERROR mismatched types
45
}
56

7+
fn bar(i: impl Sized) {
8+
//~^ HELP a return type might be missing here
9+
|| i
10+
//~^ ERROR mismatched types
11+
}
12+
613
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
error[E0308]: mismatched types
2-
--> $DIR/return-closures.rs:2:5
2+
--> $DIR/return-closures.rs:3:5
33
|
44
LL | fn foo() {
55
| - help: try adding a return type: `-> impl for<'r> Fn(&'r i32) -> i32`
6+
LL |
67
LL | |x: &i32| 1i32
78
| ^^^^^^^^^^^^^^ expected `()`, found closure
89
|
910
= note: expected unit type `()`
10-
found closure `[closure@$DIR/return-closures.rs:2:5: 2:14]`
11+
found closure `[closure@$DIR/return-closures.rs:3:5: 3:14]`
1112

12-
error: aborting due to previous error
13+
error[E0308]: mismatched types
14+
--> $DIR/return-closures.rs:9:5
15+
|
16+
LL | fn bar(i: impl Sized) {
17+
| - help: a return type might be missing here: `-> _`
18+
LL |
19+
LL | || i
20+
| ^^^^ expected `()`, found closure
21+
|
22+
= note: expected unit type `()`
23+
found closure `[closure@$DIR/return-closures.rs:9:5: 9:7]`
24+
25+
error: aborting due to 2 previous errors
1326

1427
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)