-
Notifications
You must be signed in to change notification settings - Fork 26
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
lazy_static "spin_no_std" feature is non-additive and can break unrelated code. #56
Comments
There's not a lot of uses of |
I like the idea switching to |
Once servo/rust-smallvec#301 is solved, we could get rid of it entirely |
Just to clarify, the trait bounds problem is not that significant; the more serious problem is that it forces everything in the workspace to use spinlocks instead of OS-level blocking for all To paraphrase matklad, replacing an OS-level mutex with a spinlock is bad. If people want spinlocks for bare-metal environments, they should opt in to that approach (presumably by disabling default features). And this should not happen (by accident or omission) on targets with OS mutex support. |
Perhaps we could start by disabling the |
That issue is resolved; does that mean we can fix this? |
This has really bugged me for the better part of the day. Is there a way to patch this dependency at the moment? |
num-bigint-dig
depends onlazy_static
withfeatures = ["spin_no_std"]
. This can break other crates in the same workspace.lazy_static
'sspin_no_std
feature is non-additive; it causes lazy_static to replace use ofstd::sync::Once
withspin:once::Once
. This may seem like a harmless replacement, but:spin::once::Once<T>
has different trait bounds. Namely, it only implementsSync
whereT: Send + Sync
whilelazy_static
usingstd::sync::Once
only requiresT: Sync
.lazy_static
on a non-Send
type will see their code break if thespin_no_std
feature is enabled.num-bigint-dig
as a dependency to a large workspace means that every crate in that workspace now gets the modifiedlazy_static
code usingspin
with stricter trait bounds.This is currently happening to me: I added
rsa
to a large workspace, and that change causes compile errors in unrelated (previously working) code:I'm not sure how to handle this, but it would be nice if there were a feature in
num-bigint-dig
to disable this behavior. As it is, I'm unable to add anrsa
dependency unless I fork+patchnum-bigint-dig
to disable that feature.The text was updated successfully, but these errors were encountered: