-
Notifications
You must be signed in to change notification settings - Fork 2.6k
use runtime-wasm feature instead of assuming no_std to be wasm #7275
Conversation
@brenzi, Your signature has been received. |
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.
In general the runtime-wasm
feature should only be used where it is required!
This means mostly primitives-io
, because most other crates are still using the no_std
"legally" by making themselves compilable for no-std.
Everywhere where we have special code that assumes no_std
== runtime-wasm
, we would need to switch it to runtime-wasm
.
bin/node-template/runtime/build.rs
Outdated
@@ -6,5 +6,6 @@ fn main() { | |||
.with_wasm_builder_from_crates("2.0.0") | |||
.export_heap_base() | |||
.import_memory() | |||
.append_to_rust_flags("--cfg feature=\\\"runtime-wasm\\\"") |
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.
Why?
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.
from the errors I concluded that the feature runtime-wasm
isn't applied automatically by the build script. Is that wrong?
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.
When the feature is present in the cargo.toml, the wasm-builder should activate it automatically.
bin/node/runtime/build.rs
Outdated
@@ -23,5 +23,6 @@ fn main() { | |||
.with_wasm_builder_from_crates_or_path("2.0.0", "../../../utils/wasm-builder") | |||
.export_heap_base() | |||
.import_memory() | |||
.append_to_rust_flags("--cfg feature=\\\"runtime-wasm\\\"") |
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.
?
I just tried to reset and try bottom up starting with Try and err will lead us nowhere because iterations are long as everything is rebuilt upon changes to fundamental crates. |
I would assume we need to touch at least these:
TBC |
I assume you desperately waiting for this feature? 🙈 |
well, it would make our lives a lot easier for sure 🙏 |
a880b53
to
971c20e
Compare
well, I tried a little harder, but giving up for today.... |
Does this kind of "negative feature" even work with |
Closing for a lack of progress. |
fixes #5547
Main steps done:
#[cfg(feature = "std")]
by#[cfg(not(feature = "runtime-wasm"))]
and the logical oppositeruntime-wasm
feature in all tomls (probably that's too many as not all are needed for runtime)runtime-wasm
feature to rustc argsRuntimeDebug
derivationthis is WIP. not yet sure if the approach makes sense