-
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
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 |
@rustbot ready |
…iler-errors Allow `&raw [mut | const]` for union field in safe code fixes rust-lang#141264 r? `@Veykril` Unresolved questions: - [x] Any edge cases? - [x] How this works with rust-analyzer (because all I've did is prevent compiler from emitting error in `&raw` context) (rust-lang/rust-analyzer#19867) - [x] Should we allow `addr_of!` and `addr_of_mut!` as well? In current version they both (`&raw` and `addr_of!`) are allowed (They are the same) - [x] Is chain of union fields is a safe? (Yes)
…iler-errors Allow `&raw [mut | const]` for union field in safe code fixes rust-lang#141264 r? ``@Veykril`` Unresolved questions: - [x] Any edge cases? - [x] How this works with rust-analyzer (because all I've did is prevent compiler from emitting error in `&raw` context) (rust-lang/rust-analyzer#19867) - [x] Should we allow `addr_of!` and `addr_of_mut!` as well? In current version they both (`&raw` and `addr_of!`) are allowed (They are the same) - [x] Is chain of union fields is a safe? (Yes)
Rollup merge of #141469 - Kivooeo:remove-usnsafegate, r=compiler-errors Allow `&raw [mut | const]` for union field in safe code fixes #141264 r? ``@Veykril`` Unresolved questions: - [x] Any edge cases? - [x] How this works with rust-analyzer (because all I've did is prevent compiler from emitting error in `&raw` context) (rust-lang/rust-analyzer#19867) - [x] Should we allow `addr_of!` and `addr_of_mut!` as well? In current version they both (`&raw` and `addr_of!`) are allowed (They are the same) - [x] Is chain of union fields is a safe? (Yes)
Allow `&raw [mut | const]` for union field in safe code fixes rust-lang/rust#141264 r? ``@Veykril`` Unresolved questions: - [x] Any edge cases? - [x] How this works with rust-analyzer (because all I've did is prevent compiler from emitting error in `&raw` context) (rust-lang/rust-analyzer#19867) - [x] Should we allow `addr_of!` and `addr_of_mut!` as well? In current version they both (`&raw` and `addr_of!`) are allowed (They are the same) - [x] Is chain of union fields is a safe? (Yes)
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