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

Improve borrow of immutable indexed content with NLL enabled #53228

Closed
estebank opened this issue Aug 9, 2018 · 2 comments
Closed

Improve borrow of immutable indexed content with NLL enabled #53228

estebank opened this issue Aug 9, 2018 · 2 comments
Assignees
Labels
A-borrow-checker Area: The borrow checker A-diagnostics Area: Messages for errors, warnings, and lints A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@estebank
Copy link
Contributor

estebank commented Aug 9, 2018

Follow up on #52788 and produce the following output when enabling NLL:

error[E0596]: cannot borrow immutable indexed content as mutable
  --> $DIR/index-mut-help.rs:21:5
   |
LL |     map["peter"].clear();           //~ ERROR
   |     ^^^^^^^^^^^^ cannot borrow as mutable
   |
   = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints A-borrow-checker Area: The borrow checker WG-compiler-nll NLL-diagnostics Working towards the "diagnostic parity" goal labels Aug 9, 2018
@matthewjasper
Copy link
Contributor

See also: #52086 (similar issue for Deref)

@nikomatsakis nikomatsakis added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 9, 2018
@nikomatsakis
Copy link
Contributor

Putting this on the Rust 2018 RC milestone; "diagnostics nit".

@nikomatsakis nikomatsakis added A-NLL Area: Non-lexical lifetimes (NLL) and removed WG-compiler-nll labels Aug 27, 2018
@davidtwco davidtwco self-assigned this Aug 29, 2018
bors added a commit that referenced this issue Sep 7, 2018
Add help message for missing IndexMut impl with NLL

Fixes #53228.

r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker A-diagnostics Area: Messages for errors, warnings, and lints A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants