Skip to content

Commit a12665a

Browse files
committed
Add generic parameters mismatch tests for async in traits
1 parent c0b5720 commit a12665a

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Lines changed: 16 additions & 0 deletions
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:13: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`.
Lines changed: 16 additions & 0 deletions
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:13: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`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// edition: 2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
4+
5+
#![feature(async_fn_in_trait)]
6+
#![allow(incomplete_features)]
7+
8+
trait Foo {
9+
async fn foo<T>();
10+
}
11+
12+
impl Foo for () {
13+
async fn foo<const N: usize>() {}
14+
//~^ ERROR: method `foo` has an incompatible generic parameter for trait `Foo` [E0053]
15+
}
16+
17+
fn main() {}

0 commit comments

Comments
 (0)