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 error reporting for modifications behind & references #86815

Merged
merged 1 commit into from
Jul 12, 2021

Conversation

FabianWolff
Copy link
Contributor

I had a look at #84210 and noticed that #85823 has effectively already fixed #84210.

However, the string matching in #85823 is very crude and already breaks down when a variable name starts with mut. I have made this a bit more robust; further improvements could definitely be made but are complicated by the lack of information provided by an earlier pass:

// hypothetically, `visit_primary_bindings` could try to unzip
// an outermost hir::Ty as we descend, matching up
// idents in pat; but complex w/ unclear UI payoff.
// Instead, just abandon providing diagnostic info.
opt_ty_info: None,

I have also fixed a missing comma in the error message.

@rust-highfive
Copy link
Collaborator

r? @varkor

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 2, 2021
@varkor
Copy link
Member

varkor commented Jul 11, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Jul 11, 2021

📌 Commit 5eb83f4 has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 11, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jul 11, 2021
Improve error reporting for modifications behind `&` references

I had a look at rust-lang#84210 and noticed that rust-lang#85823 has effectively already fixed rust-lang#84210.

However, the string matching in rust-lang#85823 is _very_ crude and already breaks down when a variable name starts with `mut`. I have made this a bit more robust; further improvements could definitely be made but are complicated by the lack of information provided by an earlier pass:
https://github.com/rust-lang/rust/blob/ce331ee6ee010438d1a58c7da8ced4f26d69a20e/compiler/rustc_mir_build/src/build/matches/mod.rs#L2103-L2107

I have also fixed a missing comma in the error message.
@bors
Copy link
Contributor

bors commented Jul 12, 2021

⌛ Testing commit 5eb83f4 with merge e97c29b...

@bors
Copy link
Contributor

bors commented Jul 12, 2021

☀️ Test successful - checks-actions
Approved by: varkor
Pushing e97c29b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 12, 2021
@bors bors merged commit e97c29b into rust-lang:master Jul 12, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Const reference help message does not use type annotations
5 participants