You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No line number printed with the compile error #55374
trait Foo {
type T;
fn foo(&self, t: Self::T);
}
impl Foo for u32 {
type T = ();
fn foo(&self, t: impl Clone) {}
}
fn main() {}
Output:
Compiling playground v0.0.1 (file:///playground)
error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters
error: aborting due to previous error
For more information about this error, try `rustc --explain E0049`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
This is caused by improper handling of impl Trait in argument position in diagnostics, with code assuming that if the type parameters don't match is purely due to generics. I have a small patch that will fix this issue, but we'll have to rework how we get spans for generic arguments so that all diagnostics can handle impl Trait in arg position.
Activity
estebank commentedon Nov 6, 2018
This is caused by improper handling of
impl Traitin argument position in diagnostics, with code assuming that if the type parameters don't match is purely due to generics. I have a small patch that will fix this issue, but we'll have to rework how we get spans for generic arguments so that all diagnostics can handle impl Trait in arg position.