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
Closed

Incorrectly positioned, partially hidden error message #42595

dtolnay opened this issue Jun 11, 2017 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints regression-from-stable-to-beta Performance or correctness regression from stable to beta.

Comments

@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
Copy link
Member Author

dtolnay commented Jun 11, 2017

cc @estebank who recently touched this code.

@sfackler sfackler added A-diagnostics Area: Messages for errors, warnings, and lints regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Jun 11, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Jun 16, 2017
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}`
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints regression-from-stable-to-beta Performance or correctness regression from stable to beta.
Projects
None yet
Development

No branches or pull requests

2 participants