-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut. #76965
Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut. #76965
Conversation
This is code I never touched and I also don't know what it takes to make sure this new But you'll need to find another reviewer, sorry. For now, assigning to the reviewer of the PR this follows up on. |
Edit: That PR (temporarily reverting Atomic::from_mut) is now merged. I updated this PR to revert that revert. |
Just like the other |
Thanks @m-ou-se! It looks like we ended up needing a precise cfg for this after all. So it looks like we added This seems like a reasonable addition to the current Having said that, I think @Amanieu is probably the best reviewer for this. r? @Amanieu |
…mic-from-mut, r=kodrAus Revert adding Atomic::from_mut. This reverts rust-lang#74532, which made too many assumptions about platforms, breaking some things. Will need to be added later with a better way of gating on proper alignment, without hardcoding cfg(target_arch)s. --- To be merged if fixing from_mut (rust-lang#76965) takes too long. r? @ghost
…mic-from-mut, r=kodrAus Revert adding Atomic::from_mut. This reverts rust-lang#74532, which made too many assumptions about platforms, breaking some things. Will need to be added later with a better way of gating on proper alignment, without hardcoding cfg(target_arch)s. --- To be merged if fixing from_mut (rust-lang#76965) takes too long. r? @ghost
Adding this new feature-gated cfg for atomic alignment seems perfectly reasonable to me from a language perspective. |
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.
Could you add a compile-fail ui test to ensure that from_mut
is not available on x86?
☔ The latest upstream changes (presumably #77013) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
This is needed for Atomic::from_mut.
This reverts commit 5ef1db3.
Instead of a few hardcoded cfg(target_arch = ..) like before.
950b940
to
7a04ff6
Compare
Sure. Working on it. @rustbot modify labels: -S-waiting-on-review +S-waiting-on-author |
c9c3534
to
bcc1d56
Compare
I've added the test. I made it specific for both
But still, if this test ever happens to run on some x86 Linux target with fully aligned u64s, it'll fail. But that shouldn't affect people cross compiling libcore themselves ( @rustbot modify labels: +S-waiting-on-review -S-waiting-on-author |
@bors r+ |
📌 Commit bcc1d56 has been approved by |
…-from-mut, r=Amanieu Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut. Fixes some platform-specific problems with rust-lang#74532 by using the actual alignment of the types instead of hardcoding a few `target_arch`s. r? @RalfJung
Rollup of 9 pull requests Successful merges: - rust-lang#76898 (Record `tcx.def_span` instead of `item.span` in crate metadata) - rust-lang#76939 (emit errors during AbstractConst building) - rust-lang#76965 (Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.) - rust-lang#76993 (Changing the alloc() to accept &self instead of &mut self) - rust-lang#76994 (fix small typo in docs and comments) - rust-lang#77017 (Add missing examples on Vec iter types) - rust-lang#77042 (Improve documentation for ToSocketAddrs) - rust-lang#77047 (Miri: more informative deallocation error messages) - rust-lang#77055 (Add #[track_caller] to more panicking Cell functions) Failed merges: r? `@ghost`
Fixes some platform-specific problems with #74532 by using the actual alignment of the types instead of hardcoding a few
target_arch
s.r? @RalfJung