Add generic parameters mismatch test for async in traits

This commit is contained in:
Santiago Pastorino 2023-03-16 20:41:24 -03:00
parent c7cc1c7442
commit ae7fa1d269
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
2 changed files with 31 additions and 0 deletions

View File

@ -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() {}

View File

@ -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`.