Uh oh!
There was an error while loading. Please reload this page.
NLL: fix E0594 "change to mutable ref" suggestion - #51612
Conversation
rust-highfive
commented
Jun 17, 2018
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
ashtneoi
commented
Jun 18, 2018
I broke some tests, didn't I. Gimme a sec. |
rust-highfive
commented
Jun 18, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
ashtneoi
commented
Jun 18, 2018
Okay, I think this is ready for review. Sorry about that. |
nikomatsakis
commented
Jun 19, 2018
nikomatsakis
commented
Jun 19, 2018
pnkfelix
commented
Jun 19, 2018
Hmm I think I may rebase this atop #51275 myself, preserving authorship, just to get it integrated into that rewrite of |
ashtneoi
commented
Jun 19, 2018
Sounds good! Do you need anything from my end? |
Side note: I just realized I should be matching any whitespace character after |
ashtneoi
commented
Jun 19, 2018
https://github.com/ashtneoi/rust/tree/51515-missing-first-char-spaces Here's my idea for properly matching the whitespace after |
bors
commented
Jun 19, 2018
☔ The latest upstream changes (presumably #51275) made this pull request unmergeable. Please resolve the merge conflicts. |
Should I rebase onto master or merge from it? |
eddyb
commented
Jun 24, 2018
@ashtneoi Always rebase, for Rust PRs. |
ashtneoi
commented
Jun 27, 2018
Sorry, still working on the rebase---having some trouble finding where the "ref mut" part should go. I'll let y'all know if I can't figure it out. |
nikomatsakis
commented
Jun 29, 2018
@ashtneoi sorry for the radio silence here! @pnkfelix had an unexpected issue and hasn't been able to review PRs etc and I didn't realize this was here. I can try to help you rebase maybe in a bit, but if you want, please do drop in on Zulip where the NLL working group hangs out, maybe we can help? |
nikomatsakis
commented
Jun 29, 2018
in any case, i've assigned this to myself so that I will notice it on my daily PR sweeps =) |
ashtneoi
commented
Jun 30, 2018
@nikomatsakis Hey, thanks for the update. I was busy with other things today, but I'll throw some questions up on Zulip tomorrow if things still aren't making sense. |
nikomatsakis
commented
Jul 2, 2018
@ashtneoi ok, I read the code. It seems pretty reasonable. Regarding your questions:
Seems about right. The check to look at the source span... is probably good. It's hard to "construct" good suggestions without going back to the source bytes, ultimately, although it often feels a bit hokey.
One thought I had was to check structFoo{x:u32}implFoo{fnupdate(&self){self.x += 1;}}Does this give a bad suggestion?
Yes
No |
nikomatsakis
commented
Jul 2, 2018
ashtneoi
commented
Jul 4, 2018
Been kinda busy the past few days, but tomorrow (Wednesday) night I should have some time to look at #51879 and finish rebasing. #51275 changed some aspects of how we do "add |
ashtneoi
commented
Jul 9, 2018
Status report: I think I have most of a solution and I just need to glue everything together. I'll stop trying to fit everything into a single commit and just push what I have tomorrow (Monday). |
ashtneoi
commented
Jul 9, 2018
As suggested by @.pnkfelix on Zulip, I'm narrowing the scope to just issue #51515 ( |
c6b7cab to
a49b75dComparead4109c to
6800deaCompareashtneoi
commented
Jul 9, 2018
ashtneoi
commented
Jul 9, 2018
I'm not a huge fan of case (1.) here, but I can live with it, and more importantly I think this PR is done. Hopefully I learned my lesson about trying to do too much at once. |
6800dea to
dc8ae26Compareashtneoi
commented
Jul 9, 2018
Actually |
pnkfelix
commented
Jul 10, 2018
@bors r+ rollup |
bors
commented
Jul 10, 2018
📌 Commit dc8ae26 has been approved by |
bors
commented
Jul 10, 2018
NLL: fix E0594 "change to mutable ref" suggestion Fix#51515. Fix#51879. Questions: - [x] Is this the right place to fix this? It feels brittle, being so close to the frontend. **It's probably fine.** - [ ] Have I missed any other cases that trigger this behavior? - [x] Is it okay to use HELP and SUGGESTION in the UI test? **Yes.** - [x] Do I need more tests for this? **No.**
…r=pnkfelix NLL: fix E0594 "change to mutable ref" suggestion Fixrust-lang#51515. Fixrust-lang#51879. Questions: - [x] Is this the right place to fix this? It feels brittle, being so close to the frontend. **It's probably fine.** - [ ] Have I missed any other cases that trigger this behavior? - [x] Is it okay to use HELP and SUGGESTION in the UI test? **Yes.** - [x] Do I need more tests for this? **No.**
bors
commented
Jul 10, 2018
☀️ Test successful - status-appveyor, status-travis |
Rollup of 7 pull requests Successful merges: - #51612 (NLL: fix E0594 "change to mutable ref" suggestion) - #51722 (Updated RELEASES for 1.28.0) - #52064 (Clarifying how the alignment of the struct works) - #52149 (Add #[repr(transparent)] to Atomic* types) - #52151 (Trait impl settings) - #52171 (Correct some codegen stats counter inconsistencies) - #52195 (rustc: Avoid /tmp/ in graphviz writing) Failed merges: - #52164 (use proper footnote syntax for references) r? @ghost
NLL: Suggest `ref mut` and `&mut self` Fixesrust-lang#51244. Supersedes rust-lang#51249, I think. Under the old lexical lifetimes, the compiler provided helpful suggestions about adding `mut` when you tried to mutate a variable bound as `&self` or (explicit) `ref`. NLL doesn't have those suggestions yet. This pull request adds them. I didn't bother making the help text exactly the same as without NLL, but I can if that's important. (Originally this was supposed to be part of rust-lang#51612, but I got bogged down trying to fit everything in one PR.)
NLL: Suggest `ref mut` and `&mut self` Fixes#51244. Supersedes #51249, I think. Under the old lexical lifetimes, the compiler provided helpful suggestions about adding `mut` when you tried to mutate a variable bound as `&self` or (explicit) `ref`. NLL doesn't have those suggestions yet. This pull request adds them. I didn't bother making the help text exactly the same as without NLL, but I can if that's important. (Originally this was supposed to be part of #51612, but I got bogged down trying to fit everything in one PR.)
Fix#51515.
Fix#51879.
Questions: