Skip to content

Show Foo instead of <FooConstForMethod as Foo> in E0323 #37618

Closed
@estebank

Description

@estebank

Given a file

trait Foo {
    fn bar(&self);
}

pub struct FooConstForMethod;

impl Foo for FooConstForMethod {
    const bar: u64 = 1;
}

produces output

error[E0323]: item `bar` is an associated const, which doesn't match its trait `<FooConstForMethod as Foo>`
  --> $DIR/impl-wrong-item-for-trait.rs
   |
XX |     const bar: u64 = 1;
   |     ^^^^^^^^^^^^^^^^^^^ does not match trait

as per this review from @nikomatsakis, it would make sense to change it so that the output is (at least in this case):

error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions