Check for substs compatibility for RPITITs
This commit is contained in:
parent
95a3a7277b
commit
a2037e3012
3 changed files with 44 additions and 3 deletions
17
src/test/ui/impl-trait/in-trait/generics-mismatch.rs
Normal file
17
src/test/ui/impl-trait/in-trait/generics-mismatch.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#![feature(return_position_impl_trait_in_trait)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct U;
|
||||
|
||||
trait Foo {
|
||||
fn bar(&self) -> impl Sized;
|
||||
}
|
||||
|
||||
impl Foo for U {
|
||||
fn bar<T>(&self) {}
|
||||
//~^ ERROR method `bar` has 1 type parameter but its trait declaration has 0 type parameters
|
||||
}
|
||||
|
||||
fn main() {
|
||||
U.bar();
|
||||
}
|
||||
12
src/test/ui/impl-trait/in-trait/generics-mismatch.stderr
Normal file
12
src/test/ui/impl-trait/in-trait/generics-mismatch.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters
|
||||
--> $DIR/generics-mismatch.rs:11:12
|
||||
|
|
||||
LL | fn bar(&self) -> impl Sized;
|
||||
| - expected 0 type parameters
|
||||
...
|
||||
LL | fn bar<T>(&self) {}
|
||||
| ^ found 1 type parameter
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0049`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue