Skip to content

Commit ae7fa1d

Browse files
committed
Add generic parameters mismatch test for async in traits
1 parent c7cc1c7 commit ae7fa1d

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// edition: 2021
2+
3+
#![feature(async_fn_in_trait)]
4+
#![allow(incomplete_features)]
5+
6+
trait Foo {
7+
async fn foo<T>();
8+
}
9+
10+
impl Foo for () {
11+
async fn foo<const N: usize>() {}
12+
//~^ ERROR: method `foo` has an incompatible generic parameter for trait `Foo` [E0053]
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
2+
--> $DIR/generics-mismatch.rs:11:18
3+
|
4+
LL | trait Foo {
5+
| ---
6+
LL | async fn foo<T>();
7+
| - expected type parameter
8+
...
9+
LL | impl Foo for () {
10+
| ---------------
11+
LL | async fn foo<const N: usize>() {}
12+
| ^^^^^^^^^^^^^^ found const parameter of type `usize`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0053`.

0 commit comments

Comments
 (0)