Skip to content

Conversation

@taiki-e
Copy link
Owner

@taiki-e taiki-e commented Sep 12, 2022

This adds an empty crate named portable-atomic-util.

For now, I'm considering putting the features proposed in #1 (#8) and #37 into this crate, but they may be merged into the main portable-atomic crate in the future.

Comment on lines +30 to +48
if version.minor < 36 {
println!("cargo:rustc-cfg=portable_atomic_no_alloc");
}
// raw_ref_macros stabilized in Rust 1.51 (nightly-2021-01-31) https://github.com/rust-lang/rust/pull/80886
if !version.probe(51, 2021, 1, 30) {
println!("cargo:rustc-cfg=portable_atomic_no_raw_ref_macros");
}
// unsafe_op_in_unsafe_fn stabilized in Rust 1.52 (nightly-2021-03-11): https://github.com/rust-lang/rust/pull/79208
if !version.probe(52, 2021, 3, 10) {
println!("cargo:rustc-cfg=portable_atomic_no_unsafe_op_in_unsafe_fn");
}

if version.nightly {
// `cfg(sanitize = "..")` is not stabilized.
let sanitize = env::var("CARGO_CFG_SANITIZE").unwrap_or_default();
if sanitize.contains("thread") {
println!("cargo:rustc-cfg=portable_atomic_sanitize_thread");
}
}
Copy link
Owner Author

Choose a reason for hiding this comment

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

IIRC, raw_ref_macros (addr_of! and addr_of_mut!), alloc, and cfg(sanitize = "thread") are needed to implement Arc. Some impls in #8 also need alloc.

@taiki-e
Copy link
Owner Author

taiki-e commented Sep 12, 2022

bors r+

@taiki-e
Copy link
Owner Author

taiki-e commented Sep 12, 2022

FYI @notgull

Copy link
Contributor

@notgull notgull left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@bors
Copy link
Contributor

bors bot commented Sep 12, 2022

@bors bors bot merged commit 8a653b6 into main Sep 12, 2022
@bors bors bot deleted the util branch September 12, 2022 16:48
@taiki-e taiki-e added the A-portable-atomic-util Area: related to portable-atomic-util crate label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-portable-atomic-util Area: related to portable-atomic-util crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants