Skip to content

error message for mismatched &Trait vs. &mut Trait" could be improved #13033

Closed
@ghost

Description

The error message doesn't say that the problem is mismatching mutability.

trait Foo {
    fn bar(&mut self, other: &mut Foo);
}

struct Baz;

impl Foo for Baz {
    fn bar(&mut self, other: &Foo) {}
}
test.rs:8:5: 8:38 error: method `bar` has an incompatible type: expected trait Foo but found trait Foo
test.rs:8     fn bar(&mut self, other: &Foo) {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions