-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Allow &raw [mut | const]
for union field
#19867
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
base: master
Are you sure you want to change the base?
Conversation
bb653dd
to
85227f4
Compare
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 think we should wait with this until the rust-lang/rust PR is merged, or at least the FCP completes.
I decided to stick with separate methods because of I dont know how to rewrite this without recursion, and, I believe, it should be fine like this (not inlined) even if we used this methods just for this single case |
I feel like it'll be better (and more performant) if we'll just unconditionally call |
} | ||
|
||
union LessOuter { | ||
lessouter: ManuallyDrop<MoreInner>, |
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.
ManuallyDrop
is not resolved, just include the type without it.
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.
does it mean the test is not correct in it's current state? i will look into it little bit later today
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.
Yes, as in "it does not test the thing it should".
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.
oh, thanks for this catch, but, can i add this import into test somehow? as far as i remember it wont work without ManuallyDrop
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.
Yes, you can add //- minicore: manually_drop, deref
at the top of the test and also use core::mem::ManuallyDrop
.
follow up rust-lang/rust#141469
i didn’t test it locally, just relying on the tests for now. also not really familiar with rust-analyzer code, but tried my best
if there’s anything that can be improved, feel free to point it out
r? @Veykril