Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly positioned, partially hidden error message #42595

Closed
dtolnay opened this Issue Jun 11, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@dtolnay
Copy link
Member

dtolnay commented Jun 11, 2017

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}`
@dtolnay

This comment has been minimized.

Copy link
Member Author

dtolnay commented Jun 11, 2017

cc @estebank who recently touched this code.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Jun 16, 2017

Rollup merge of rust-lang#42616 - estebank:span-fix, r=nikomatsakis
Position span label correctly when it isn't last

Fix rust-lang#42595.

Before:

```
15 |     map.entry("e").or_insert(0) += 1;
   |     ---------------------------^^^^^ot use `+=` on type `&mut {integer}`
```

After:

```
15 |     map.entry("e").or_insert(0) += 1;
   |     ---------------------------^^^^^
   |     |
   |     cannot use `+=` on type `&mut {integer}`
```

@bors bors closed this in #42616 Jun 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.