Skip to content

atomic128: use the new intrinsics::atomic_load #210

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

Closed
wants to merge 1 commit into from

Conversation

teskje
Copy link

@teskje teskje commented Jun 5, 2025

In rust-lang/rust#141507, the atomic_load_{ordering} intrinsics were gated behind the bootstrap config and replaced with a single atomic_load intrinsic. This breaks running Miri on this crate with a recent nightly version:

error[E0425]: cannot find function `atomic_load_acquire` in module `intrinsics`
   --> src/imp/atomic128/intrinsics.rs:76:36
    |
76  |             Acquire => intrinsics::atomic_load_acquire(src),
    |                                    ^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `atomic_and_acquire`
    |
   ::: /Users/jan/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/intrinsics/mod.rs:656:1
    |
656 | pub unsafe fn atomic_and_acquire<T: Copy>(dst: *mut T, src: T) -> T;
    | -------------------------------------------------------------------- similarly named function `atomic_and_acquire` defined here
    |
note: found an item that was configured out
   --> /Users/jan/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/intrinsics/mod.rs:437:15
    |
437 | pub unsafe fn atomic_load_acquire<T: Copy>(src: *const T) -> T;
    |               ^^^^^^^^^^^^^^^^^^^
note: the item is gated here
   --> /Users/jan/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/intrinsics/mod.rs:436:1
    |
436 | #[cfg(bootstrap)]
    | ^^^^^^^^^^^^^^^^^

[...]

This PR moves the portable-atomic crate to that new intrinsic to unbreak Miri.

In rust-lang/rust#141507, the `atomic_load_{ordering}` intrinsics were
gated behind the `bootstrap` config and replaced with a single
`atomic_load` intrinsic. This commit moves the portable-atomic crate to
that new intrinsic.
@teskje
Copy link
Author

teskje commented Jun 5, 2025

Well, looks like just replacing isn't going to work. Is there a way to version-gate based on a nightly version?

@taiki-e
Copy link
Owner

taiki-e commented Jun 5, 2025

Thanks for the PR!

From looking at the rust-lang/rust PR that made this change, it seemed they intended to change other intrinsics in the near future, so for now I plan to simply disable it in recent nightlies affected: 4420e87

@taiki-e taiki-e closed this in f720ee1 Jun 5, 2025
@teskje
Copy link
Author

teskje commented Jun 5, 2025

Makes sense, thanks!

@taiki-e
Copy link
Owner

taiki-e commented Jun 6, 2025

Published the fix for this issue in portable-atomic 1.11.1.

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.

2 participants