Closed
Description
Trait function API mismatches (where the impl differs from the declaration) report the correct error about the mismatch, but also give a more detailed note like
= note: expected fn pointer `fn(&())`
found fn pointer `fn(())`
This could cause some confusion as the user hasn't done anything with function pointers.
trait Foo {
fn foo(&self);
}
impl Foo for () {
fn foo(self) {}
}
Errors:
Compiling playground v0.0.1 (/playground)
error[E0053]: method `foo` has an incompatible type for trait
--> src/lib.rs:6:12
|
2 | fn foo(&self);
| ----- type in trait
...
6 | fn foo(self) {}
| ^^^^ expected `&()`, found `()`
|
= note: expected fn pointer `fn(&())`
found fn pointer `fn(())`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0053`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.