-
Notifications
You must be signed in to change notification settings - Fork 307
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
Make compatible with thumbv6m-none-eabi #1384
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,12 @@ | |
#[allow(unused_imports)] | ||
use rawpointer::PointerExt; | ||
|
||
#[cfg(target_has_atomic = "ptr")] | ||
use alloc::sync::Arc; | ||
|
||
#[cfg(not(target_has_atomic = "ptr"))] | ||
use portable_atomic_util::Arc; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this affect user experience at all, does it change the API? It's encapsulated right, so almost nothing can change - fortunately - but if I didn't check this then something like Send- or Sync-ness of some types could change or something like that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think Send or Sync should be modified, as far as I can tell here is the only possible public APIs that might be impacted
/// ArcArray's representation.
///
/// *Don’t use this type directly—use the type alias
/// [`ArcArray`] for the array type!*
#[derive(Debug)]
pub struct OwnedArcRepr<A>(Arc<OwnedRepr<A>>);
|
||
|
||
#[cfg(not(feature = "std"))] | ||
use alloc::vec::Vec; | ||
use std::mem::MaybeUninit; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these dependencies be automatically enabled for the relevant platform? I would feel a lot better about this, also lower complexity, if we just managed it all that way with no user visible impact, no feature enablement needed as well.
It's rare that it can be done that way, but here I think the one Arc is a drop-in for the other, and it should work well (?). Or do you see a problem with that?
And yes, it would be good to test this in CI, at least test building it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that the
critical-section
feature is recommended to be passed by the library, as mentioned byportable-atomic
.According to the Arc docs, we can detect if the target has access to Arc from the configuration flag
target_has_atomic = "ptr"