cef736f8a0
Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types and constants.
49 lines
1.1 KiB
Rust
49 lines
1.1 KiB
Rust
trait Foo {
|
|
type Type;
|
|
|
|
fn foo();
|
|
fn bar();
|
|
fn qux();
|
|
}
|
|
|
|
struct A;
|
|
|
|
impl Foo for A {
|
|
//~^ ERROR not all trait items implemented
|
|
type Typ = ();
|
|
//~^ ERROR type `Typ` is not a member of trait
|
|
//~| HELP there is an associated type with a similar name
|
|
|
|
fn fooo() {}
|
|
//~^ ERROR method `fooo` is not a member of trait
|
|
//~| HELP there is an associated function with a similar name
|
|
|
|
fn barr() {}
|
|
//~^ ERROR method `barr` is not a member of trait
|
|
//~| HELP there is an associated function with a similar name
|
|
|
|
fn quux() {}
|
|
//~^ ERROR method `quux` is not a member of trait
|
|
//~| HELP there is an associated function with a similar name
|
|
}
|
|
//~^ HELP implement the missing item
|
|
//~| HELP implement the missing item
|
|
//~| HELP implement the missing item
|
|
//~| HELP implement the missing item
|
|
|
|
trait Bar {
|
|
const Const: i32;
|
|
}
|
|
|
|
struct B;
|
|
|
|
impl Bar for B {
|
|
//~^ ERROR not all trait items implemented
|
|
const Cnst: i32 = 0;
|
|
//~^ ERROR const `Cnst` is not a member of trait
|
|
//~| HELP there is an associated constant with a similar name
|
|
}
|
|
//~^ HELP implement the missing item
|
|
|
|
fn main() {}
|