Skip to content

Silence missing _ in implementation for items that was suggested to change #89326

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

Open
hkmatsumoto opened this issue Sep 28, 2021 · 0 comments
Open
Labels
A-diagnostics Area: Messages for errors, warnings, and lints P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hkmatsumoto
Copy link
Member

hkmatsumoto commented Sep 28, 2021

After #89248 is merged, given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=131d171b09722b4e0ab4258726edb3a0

trait Foo {
    type Type;

    fn foo();
    fn bar();
    fn qux();
}

struct A;

impl Foo for A {
    type Typ = ();
    
    fn fooo() {}
    fn barr() {}
    fn quux() {}
}

The output will be:

error[E0437]: type `Typ` is not a member of trait `Foo`
  --> src/lib.rs:12:5
   |
12 |     type Typ = ();
   |     ^^^^^---^^^^^^
   |     |    |
   |     |    help: there is an associated type with a similar name: `Type`
   |     not a member of trait `Foo`

error[E0407]: method `fooo` is not a member of trait `Foo`
  --> src/lib.rs:14:5
   |
14 |     fn fooo() {}
   |     ^^^----^^^^^
   |     |  |
   |     |  help: there is an associated function with a similar name: `foo`
   |     not a member of trait `Foo`

error[E0407]: method `barr` is not a member of trait `Foo`
  --> src/lib.rs:15:5
   |
15 |     fn barr() {}
   |     ^^^----^^^^^
   |     |  |
   |     |  help: there is an associated function with a similar name: `bar`
   |     not a member of trait `Foo`

error[E0407]: method `quux` is not a member of trait `Foo`
  --> src/lib.rs:16:5
   |
16 |     fn quux() {}
   |     ^^^----^^^^^
   |     |  |
   |     |  help: there is an associated function with a similar name: `qux`
   |     not a member of trait `Foo`

error[E0046]: not all trait items implemented, missing: `Type`, `foo`, `bar`, `qux`
  --> src/lib.rs:11:1
   |
2  |     type Type;
   |     ---------- `Type` from trait
3  |
4  |     fn foo();
   |     --------- `foo` from trait
5  |     fn bar();
   |     --------- `bar` from trait
6  |     fn qux();
   |     --------- `qux` from trait
...
11 | impl Foo for A {
   | ^^^^^^^^^^^^^^ missing `Type`, `foo`, `bar`, `qux` in implementation

Ideally the output should look like:

error[E0437]: type `Typ` is not a member of trait `Foo`
  --> src/lib.rs:12:5
   |
12 |     type Typ = ();
   |     ^^^^^---^^^^^^
   |     |    |
   |     |    help: there is an associated type with a similar name: `Type`
   |     not a member of trait `Foo`

error[E0407]: method `fooo` is not a member of trait `Foo`
  --> src/lib.rs:14:5
   |
14 |     fn fooo() {}
   |     ^^^----^^^^^
   |     |  |
   |     |  help: there is an associated function with a similar name: `foo`
   |     not a member of trait `Foo`

error[E0407]: method `barr` is not a member of trait `Foo`
  --> src/lib.rs:15:5
   |
15 |     fn barr() {}
   |     ^^^----^^^^^
   |     |  |
   |     |  help: there is an associated function with a similar name: `bar`
   |     not a member of trait `Foo`

error[E0407]: method `quux` is not a member of trait `Foo`
  --> src/lib.rs:16:5
   |
16 |     fn quux() {}
   |     ^^^----^^^^^
   |     |  |
   |     |  help: there is an associated function with a similar name: `qux`
   |     not a member of trait `Foo`

In other words, ideally we could silence missing `...` in implementation for the items informed that a similarly-named item is available.

@hkmatsumoto hkmatsumoto added A-diagnostics Area: Messages for errors, warnings, and lints P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 28, 2021
@hkmatsumoto hkmatsumoto changed the title Silence `missing _ in implementation` for items that was suggested to change Silence `missing item in implementation` for items that was suggested to change Sep 28, 2021
@hkmatsumoto hkmatsumoto changed the title Silence `missing item in implementation` for items that was suggested to change Silence missing _ in implementation for items that was suggested to change Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant