-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic parameters mismatch test for async in traits
- Loading branch information
1 parent
c7cc1c7
commit ae7fa1d
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// edition: 2021 | ||
|
||
#![feature(async_fn_in_trait)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Foo { | ||
async fn foo<T>(); | ||
} | ||
|
||
impl Foo for () { | ||
async fn foo<const N: usize>() {} | ||
//~^ ERROR: method `foo` has an incompatible generic parameter for trait `Foo` [E0053] | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo` | ||
--> $DIR/generics-mismatch.rs:11:18 | ||
| | ||
LL | trait Foo { | ||
| --- | ||
LL | async fn foo<T>(); | ||
| - expected type parameter | ||
... | ||
LL | impl Foo for () { | ||
| --------------- | ||
LL | async fn foo<const N: usize>() {} | ||
| ^^^^^^^^^^^^^^ found const parameter of type `usize` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0053`. |