Skip to content

Incorrectly positioned, partially hidden error message #42595

Closed
@dtolnay

Description

@dtolnay
use std::collections::BTreeMap;

fn main() {
    let mut map = BTreeMap::new();
    map.entry("e").or_insert(0) += 1;
}

rustc 1.18.0 (03fc9d6 2017-06-06)

error[E0368]: binary assignment operation `+=` cannot be applied to type `&mut {integer}`
 --> src/main.rs:5:5
  |
5 |     map.entry("e").or_insert(0) += 1;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use `+=` on type `&mut {integer}`

rustc 1.19.0-beta.1 (a879841 2017-06-06) and rustc 1.19.0-nightly (4bf5c99 2017-06-10)

error[E0368]: binary assignment operation `+=` cannot be applied to type `&mut {integer}`
 --> src/main.rs:5:5
  |
5 |     map.entry("e").or_insert(0) += 1;
  |     ---------------------------^^^^^ot use `+=` on type `&mut {integer}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsregression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions