Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty #109238

Merged
merged 2 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add generic parameters mismatch test for async in traits
  • Loading branch information
spastorino committed Mar 17, 2023
commit ae7fa1d269a3346372562570da3c51625027097b
15 changes: 15 additions & 0 deletions tests/ui/async-await/in-trait/generics-mismatch.rs
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() {}
16 changes: 16 additions & 0 deletions tests/ui/async-await/in-trait/generics-mismatch.stderr
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`.