Skip to content

Conversation

Kivooeo
Copy link
Member

@Kivooeo Kivooeo commented May 26, 2025

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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 26, 2025
@Kivooeo Kivooeo force-pushed the unsafegate branch 5 times, most recently from bb653dd to 85227f4 Compare May 26, 2025 12:35
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a 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.

@Kivooeo
Copy link
Member Author

Kivooeo commented Jun 27, 2025

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

@ChayimFriedman2
Copy link
Contributor

I feel like it'll be better (and more performant) if we'll just unconditionally call walk_field_chain_for_raw_ptr().

@Kivooeo
Copy link
Member Author

Kivooeo commented Sep 20, 2025

@rustbot ready

@Veykril Veykril enabled auto-merge September 28, 2025 11:54
@Veykril Veykril added this pull request to the merge queue Sep 28, 2025
Merged via the queue into rust-lang:master with commit 5c0b555 Sep 28, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 28, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 28, 2025
…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)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 28, 2025
…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)
rust-timer added a commit to rust-lang/rust that referenced this pull request Sep 28, 2025
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)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 29, 2025
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants