Skip to content

Commit a5093fe

Browse files
committed
Add type-mismatch ui test
1 parent 6d12b44 commit a5093fe

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

tests/ui/type-mismatch.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use async_trait::async_trait;
2+
3+
#[async_trait]
4+
trait Interface {
5+
async fn f(&self);
6+
async fn g(&self) -> ();
7+
}
8+
9+
struct Thing;
10+
11+
#[async_trait]
12+
impl Interface for Thing {
13+
async fn f(&self) {
14+
0
15+
}
16+
async fn g(&self) {
17+
0
18+
}
19+
}
20+
21+
fn main() {}

tests/ui/type-mismatch.stderr

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0308]: mismatched types
2+
--> tests/ui/type-mismatch.rs:13:23
3+
|
4+
13 | async fn f(&self) {
5+
| _______________________^
6+
14 | | 0
7+
15 | | }
8+
| |_____^ expected integer, found `()`
9+
10+
error[E0308]: mismatched types
11+
--> tests/ui/type-mismatch.rs:16:23
12+
|
13+
16 | async fn g(&self) {
14+
| _______________________^
15+
17 | | 0
16+
18 | | }
17+
| |_____^ expected integer, found `()`

0 commit comments

Comments
 (0)