-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[NLL] Suggest let binding #54088
[NLL] Suggest let binding #54088
Conversation
Allows callers to change other parts of their message based on the explanation
r? @oli-obk (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 54f7311 has been approved by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but...
@@ -8,6 +8,8 @@ LL | v3.push(&id('x')); // statement 6 | |||
... | |||
LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); | |||
| -- borrow later used here | |||
| | |||
= note: consider using a `let` binding to create a longer lived value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the temporary rules are a common source of confusion. I think we should consider using a distinct error code for them, so that --explain
can have some extra text to introduce the rules. Maybe good for a follow-up to this PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #54131
☀️ Test successful - status-appveyor, status-travis |
Closes #49821
Also adds an alternative to
explain_why_borrow_contains_point
that allows changing error messages based on the reason that will be given. This will also be useful for #51026, #51169 and maybe further changes to does not live long enough messages.