Skip to content

Improve error message in operator expression #2030

Description

@philberty

Tried this test case: https://github.com/rust-lang/rust/blob/aa3ca1994904f2e056679fce1f185db8c7ed2703/src/test/ui/issue-10401.rs

fn main() {
    let mut a = "a";
    a += { "b" };
    //~^ ERROR: binary assignment operation `+=` cannot be applied
}

We return: https://godbolt.org/z/P9zGT19rs

<source>:3:5: error: cannot apply this operator to types & str and & str
    3 |     a += { "b" };
      |     ^

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions