Skip to content

Suggested fix doesn't work in error [E0034] #116703

Closed
@tae-soo-kim

Description

@tae-soo-kim

Code

trait A {
    fn foo(&self);
}

trait B {
    fn foo(&self);
}

struct S;

impl A for S {
    fn foo(&self) {}
}

impl B for S {
    fn foo(&self) {}
}

fn main() {
    let s = S;
    S::foo(&s);
}

Current output

help: disambiguate the method for candidate #1
   |
21 |     <&S as A>::foo(&s);
   |     ~~~~~~~~~~~

Desired output

help: disambiguate the method for candidate #1
   |
21 |     <S as A>::foo(&s);
   |     ~~~~~~~~~~~

Rationale and extra context

Current output has an extra & in the suggested fix that fails compilation.

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions