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

Incorrect span in &mut suggestion #49859

Closed
estebank opened this issue Apr 10, 2018 · 0 comments
Closed

Incorrect span in &mut suggestion #49859

estebank opened this issue Apr 10, 2018 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@estebank
Copy link
Contributor

#48914 introduces a suggestion with an incorrect span:

error[E0594]: cannot assign to data in a `&` reference
  --> $DIR/issue-47388.rs:18:5
   |
LL |     let fancy_ref = &(&mut fancy);
   |                     ------------- help: consider changing this to be a mutable reference: `&mut`
LL |     fancy_ref.num = 6; //~ ERROR E0594
   |     ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written

The output should be either

LL |     let fancy_ref = &(&mut fancy);
   |                     - help: consider changing this to be a mutable reference: `&mut `

or

LL |     let fancy_ref = &(&mut fancy);
   |                     ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
@estebank estebank added the A-diagnostics Area: Messages for errors, warnings, and lints label Apr 10, 2018
@estebank estebank added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Apr 11, 2018
kennytm added a commit to kennytm/rust that referenced this issue Apr 16, 2018
Fix incorrect span in `&mut` suggestion

Fixes rust-lang#49859
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 E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

1 participant