-
Notifications
You must be signed in to change notification settings - Fork 480
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
How can I enable --cfg=crossbeam_loom
in a dependency?
#1173
Comments
Loom is cfg-ed optional dependency, so you have to enable both crossbeam/crossbeam-utils/Cargo.toml Lines 34 to 39 in 75d24e0
This is a bit odd, but unfortunately necessary to address the problem that the way cargo and crates.io handle cfg-ed dependencies is not very good, confuses users, and some people complain when new dependency appears in Cargo.lock (even if it never actually builds). |
Ah, thanks for your answer! The following: [target.'cfg(crossbeam_loom)'.dependencies]
crossbeam-utils = { version = "0.8", features = ["loom"] }
crossbeam-epoch = { version = "0.9", features = ["loom"] } ...with a |
The issue is that they do not work because they have different structures to begin with. The implementation before #787 is completely broken. AFAIK, what could be implemented is a fallback implementation, such as the one referenced by the review comment in that PR, or one that just uses Mutex internally. (Or change something on the Loom side.) So, for now, I would suggest using Mutex or RwLock instead of AtomicCell when using Loom. |
Ah, I didn't realize that was the case. Good to know.
I can use a lock in the short-term when consuming crossbeam. If you'd like, I'd also be happy to have crossbeam itself fallback to |
If you are talking about crossbeam_queue::SegQueue, crossbeam_queue doesn't use The reason why crossbeam_queue does not currently support Loom is for a completely different reason. When I tried it before, unbounded queue panicked with odd errors like tokio-rs/loom#283. |
Hello! I'm trying to enable Loom in https://github.com/salsa-rs/salsa/. Since Salsa uses crossbeam (namely,
SegQueue
andAtomicCell
) to write some fiddly, unsafe code, I wanted to also enable crossbeam'scrossbeam_loom
feature flag. Unfortunately, I've been struggling to enable it viaRUSTFLAGS
. For instance, aenv RUSTFLAGS="--cfg=crossbeam_loom" cargo check
doesn't seem to enable correctly enablecrossbeam_util
's Loom flag, failing with with errors along the lines of:How can I enable crossbeam's Loom flag? Is it... even possible?
The text was updated successfully, but these errors were encountered: