Add generic parameters mismatch test for async in traits
This commit is contained in:
parent
c7cc1c7442
commit
ae7fa1d269
15
tests/ui/async-await/in-trait/generics-mismatch.rs
Normal file
15
tests/ui/async-await/in-trait/generics-mismatch.rs
Normal 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() {}
|
16
tests/ui/async-await/in-trait/generics-mismatch.stderr
Normal file
16
tests/ui/async-await/in-trait/generics-mismatch.stderr
Normal 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`.
|
Loading…
x
Reference in New Issue
Block a user