-
Notifications
You must be signed in to change notification settings - Fork 13.3k
error message when trying to move from an Rc or Arc is ungreat #54703
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
Conversation
This comment has been minimized.
This comment has been minimized.
Nice! Just curious, was there any discussion of fixing this for smart pointer types other than Rc and Arc? (i.e. any type that used Deref along the path) I have no idea if this is possible. This clearly fixes the most important error messages, but wonder if it could be done more generically at some point. |
This commit introduces language items for `Arc` and `Rc` so that types can later be checked to be `Arc` or `Rc` in the NLL borrow checker. The `lang` attribute is currently limited to `stage1` as it requires a compiler built with knowledge of the expected language items.
This commit special cases the move out of borrowed content error, previously: ``` error[E0507]: cannot move out of borrowed content --> src/main.rs:7:10 | 7 | drop(x.field); | ^ cannot move out of borrowed content ``` to instead mention that it is a move out of a `Rc`/`Arc` which is more helpful: ``` error[E0507]: cannot move out of an `Rc` --> src/main.rs:7:10 | 7 | drop(x.field); | ^ cannot move out of an `Rc` ```
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.
Thoughts?
src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr
Show resolved
Hide resolved
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.
Thoughts?
(I'm ok with starting with the Rc-Arc error for now) |
src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr
Outdated
Show resolved
Hide resolved
@bors r=nikomatsakis |
📌 Commit 8c6d08b has been approved by |
⌛ Testing commit 8c6d08b with merge eaddf285fca351a00a98cb4996794ed2eebb46e3... |
💔 Test failed - status-travis |
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 |
@bors retry |
error message when trying to move from an Rc or Arc is ungreat Fixes #52086. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
Fixes #52086.
r? @nikomatsakis