rustc_data_structures: Explicitly check for 64-bit atomics support by glaubitz · Pull Request #127075 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation13 Commits1 Checks6 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

glaubitz

Instead of keeping a list of architectures which have native support
for 64-bit atomics, just use #[cfg(target_has_atomic = "64")] and its
inverted counterpart to determine whether we need to use portable
AtomicU64 on the target architecture.

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Jun 28, 2024

@taiki-e

FWIW, I think we can use #[cfg(target_has_atomic = "64")]/#[cfg(not(target_has_atomic = "64"))] instead of listing concrete architecture names.

@glaubitz

FWIW, I think we can use #[cfg(target_has_atomic = "64")]/#[cfg(not(target_has_atomic = "64"))] instead of listing concrete architecture names.

Good idea. Can we use this in the Cargo.toml as well?

@taiki-e

Can we use this in the Cargo.toml as well?

Yes. (For example, cargo and pyo3 uses it in Cargo.toml.)

@glaubitz

Can we use this in the Cargo.toml as well?

Yes. (For example, cargo and pyo3 uses it in Cargo.toml.)

OK, testing this now. Thanks a lot for the suggestion!

@SparrowLii

Thanks! If #[cfg(target_has_atomic = "64")] works it's the best
r? @SparrowLii

@SparrowLii

@bors delegate+
r=me after your testing

@bors

✌️ @glaubitz, you can now approve this pull request!

If @SparrowLii told you to "r=me" after making some further change, please make that change, then do @bors r=@SparrowLii

@glaubitz

Instead of keeping a list of architectures which have native support for 64-bit atomics, just use #[cfg(target_has_atomic = "64")] and its inverted counterpart to determine whether we need to use portable AtomicU64 on the target architecture.

@glaubitz glaubitz changed the titlerustc_data_structures: Fix copy-and-paste error from previous change rustc_data_structures: Explicitly check for 64-bit atomics support

Jun 28, 2024

@glaubitz

@bors

📌 Commit ab1b48e has been approved by SparrowLii

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jun 28, 2024

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request

Jun 28, 2024

@GuillaumeGomez

…rrowLii

rustc_data_structures: Explicitly check for 64-bit atomics support

Instead of keeping a list of architectures which have native support for 64-bit atomics, just use #[cfg(target_has_atomic = "64")] and its inverted counterpart to determine whether we need to use portable AtomicU64 on the target architecture.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jun 28, 2024

@bors

…llaumeGomez

Rollup of 10 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

@glaubitz

@SparrowLii This seems to be fallen out of the merge queue. Any ideas?

@SparrowLii

@glaubitz Seems not related to this PR
https://github.com/rust-lang-ci/rust/actions/runs/9711788661/job/26805261710
or
plain

 thread 'main' panicked at src/lib.rs:1712:17:
  failed to copy `C:\a\rust\rust\build\x86_64-pc-windows-msvc\stage1-tools\x86_64-pc-windows-msvc\release\miri.exe` to `C:\a\rust\rust\build\x86_64-pc-windows-msvc\stage1-tools-bin\miri.exe`: The process cannot access the file because it is being used by another process. (os error 32)
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:09
  local time: Fri, Jun 28, 2024 12:32:23 PM
  network time: Fri, 28 Jun 2024 12:32:23 GMT
Error: Process completed with exit code 1.

Just wait for #127111 to merge

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jun 29, 2024

@bors

…iaskrgr

Rollup of 9 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Jun 29, 2024

@rust-timer

Rollup merge of rust-lang#127075 - glaubitz:copy-and-paste-fix, r=SparrowLii

rustc_data_structures: Explicitly check for 64-bit atomics support

Instead of keeping a list of architectures which have native support for 64-bit atomics, just use #[cfg(target_has_atomic = "64")] and its inverted counterpart to determine whether we need to use portable AtomicU64 on the target architecture.

songdongsheng

// MIPS, PowerPC and SPARC platforms with 32-bit pointers do not
// have AtomicU64 type.
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc", target_arch = "sparc")))]
// Use portable AtomicU64 for targets without native 64-bit atomics

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong comment position, should be placed before line 156.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment applies to both the following statements, see the comment from the previous version.

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.