-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[NLL] Use new region infer errors when explaining borrows #55069
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[NLL] Use new region infer errors when explaining borrows #55069
Conversation
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.
This is awesome. I proposed some tweaks to wording. Thoughts?
src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr
Show resolved
Hide resolved
src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr
Outdated
Show resolved
Hide resolved
src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr
Outdated
Show resolved
Hide resolved
bc3a96f
to
2245840
Compare
r=me but r? @pnkfelix on the one remaining question |
@bors r=nikomatsakis |
📌 Commit 22458404d6bb34a0754dd2614b0417a4ddb7b66c has been approved by |
☔ The latest upstream changes (presumably #55134) made this pull request unmergeable. Please resolve the merge conflicts. |
f001861
to
4418569
Compare
@bors r=nikomatsakis |
📌 Commit 4418569d8feb686360a71bde2c6172af85196bbd has been approved by |
⌛ Testing commit 4418569d8feb686360a71bde2c6172af85196bbd with merge 1943e725a2e9dd16eca66aa63b642e9618a0382b... |
💔 Test failed - status-appveyor |
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 |
Adds UseAsConst and UseAsStatic to replace Return in consts/statics. Don't report the arguments to an overloaded operator as CallArguments. Also don't report "escaping data" in these items.
4418569
to
5d1896b
Compare
@bors r=nikomatsakis |
📌 Commit 5d1896b2b165966aee793f3c7c2f769cc08fb82f has been approved by |
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 |
⌛ Testing commit 5d1896b2b165966aee793f3c7c2f769cc08fb82f with merge 6f8d54c93da893ef598344137cb3fc950997a35b... |
💔 Test failed - status-appveyor |
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 |
This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable.
5d1896b
to
2a3969a
Compare
@bors r=nikomatsakis |
📌 Commit 2a3969a has been approved by |
…nikomatsakis [NLL] Use new region infer errors when explaining borrows Use the new free region infer errors for explaining borrows This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable. (E0521) Closes #51026 - `regions-nested-fns-2.rs` isn't changed to that diagnostic, since that would not be the correct error here. Closes #51169 cc #53882 - The error is (IMO) better now, but it could be better when we trace lifetimes in these error messages. r? @nikomatsakis cc @pnkfelix
☀️ Test successful - status-appveyor, status-travis |
Use the new free region infer errors for explaining borrows
This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:
Closes #51026 -
regions-nested-fns-2.rs
isn't changed to that diagnostic, since that would not be the correct error here.Closes #51169
cc #53882 - The error is (IMO) better now, but it could be better when we trace lifetimes in these error messages.
r? @nikomatsakis cc @pnkfelix