Skip to content

Reassign E0406 to be thrown when undeclared associated type appears in function signature. #34301

Closed
@nikhilshagri

Description

@nikhilshagri

Currently, when an undeclared associated type is used in a function signature within a trait body, like:

trait Foo {
    type Bar;
    //error: Baz is used but not declared
    fn return_bool(&self, &Self::Bar, &Self::Baz) -> bool;
}

it throws E0220, which isn't really helpful in this situation. Also, I found E0406 to be the more appropriate error here. This error is thrown for some feature which hasn't been implemented yet( and probably won't be), so it can be repurposed. See #34230 for more.
We could modify the error message for E0220 to include the above erroneous code, but I think it would be better to throw E0406 instead of E0220 in this situation.

/cc @GuillaumeGomez

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions