-
Notifications
You must be signed in to change notification settings - Fork 85
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 Wasm support dependent on target_arch
rather than feature
#666
Conversation
That should be a separate small PR, since it will change the builder options in Rust and Wasm too.
|
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.
Looks good to me.
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.
Looks good to me. Thanks for the changes.
task1.await.expect("task1 failed to execute to completion")?; | ||
task2.await.expect("task2 failed to execute to completion")?; |
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.
Apparently join
is still suggested to await both tasks but it really doesn't matter since it doesn't affect the parallelism as you demonstrated.
https://docs.rs/tokio/latest/tokio/macro.join.html#runtime-characteristics
If parallelism is required, spawn each async expression using tokio::spawn and pass the join handle to join!.
No changes requested, just wanted to drop a link to the quote.
Description of change
Essentially, this changes all
cfg(feature = "wasm")
occurrences tocfg(all(target_arch = "wasm32", not(target_os = "wasi")))
and removes thewasm
feature from all crates. Since we only have two occurrences of those in code, most of this applies to variousCargo.toml
s. The motivation is to enableFuture
s that contain anAccount
to beSend
. This is not the case in currentdev
, because ofiota_client::Client
. An example that does not compile under currentdev
:which fails with:
This compiles under this PR (partly because of changes in iota.rs/804, which this PR depends upon) but subsequent errors are of similar sort. This was added as a static assertion ("compile time test") to prevent a future regression.
Note that this only fails when running
cargo check --all-features
(which is what CI does), while omitting thewasm
feature does not produce this error. The issue is that checking this assertion test under thewasm
feature is not what we want, because in Wasm we don't require the future to beSend
, but we do on other targets. Thus, moving conditional compilation for Wasm to target_arch rather than feature seems to be more in line with howcfg
s are supposed to work.It's noteworthy that this same type of fix could be used to fix iota.rs, which would not require us to make the change. However, for the just-mentioned reasons, it seems like an improvement to our crates, to prevent future issues target-feature inconsistencies that might not be related to iota.rs.
Important: This points iota.rs to a not-yet-merged commit, so this PR should only be merged after iota.rs/804 has been merged.
This is marked as a breaking change, since the wasm feature was removed from various crates.
This will require #597 to change it's
cfg_attr
s, and likely introduce a separate feature for non-Send
-Storage
(FYI @HenriqueNogara).Unsure if this PR should also make use of the now-runtime configurable POW fallback on iota.rs, which the above mentioned PR changed.
Thanks to @cycraig for suggesting this idea initially!
Added
Future
s containing anAccount
areSend
Changed
multiple_identities
example to showcase concurrent updates to two accountscargo check --target wasm32-unknown-unknown
for the Wasm bindingsRemoved
cargo test
in the Wasm bindings which does not do anything because there are no tests. This still runs thewasm_bindgen_test
s in CI throughnpm run test
.Links to any relevant issues
None
Type of change
Add an
x
to the boxes that are relevant to your changes.How the change has been tested
Describe the tests that you ran to verify your changes.
Make sure to provide instructions for the maintainer as well as any relevant configurations.
Change checklist
Add an
x
to the boxes that are relevant to your changes.