@@ -51,9 +51,19 @@ raised about `#![no_std]`:
51
51
for the Rust standard library the JIT compiler of Wasmtime often won't run on
52
52
the platform as well. The JIT compiler requires ` mmap ` (or an equivalent), and
53
53
presence of ` mmap ` often implies presence of a libc which means Rust's ` std `
54
- library works. We're interested in running Wasmtime without a JIT compiler in
55
- the future, but that is not implemented at this time. Implementing this will
56
- require a lot more work than tagging crates ` #![no_std] ` as well! The Wasmtime
54
+ library works.
55
+
56
+ Cargo's [ ` -Z build-std ` feature] [ zbuild-std ] feature is also intended to help
57
+ easily build the standard library for all platforms. With this feature you can
58
+ recompile the standard library (using Nightly Rust for now) with a [ custom
59
+ target specification] [ custom-target ] if necessary. Additionally the intention
60
+ at this time is to get ` std ` building for all platforms, regardless of what
61
+ the platform actually supports. This change is taking time to implement, but
62
+ [ rust-lang/rust #74033 ] is an example of this support growing over time.
63
+
64
+ We're also interested in running Wasmtime without a JIT compiler in the
65
+ future, but that is not implemented at this time. Implementing this will
66
+ require a lot more work than tagging crates ` #![no_std] ` . The Wasmtime
57
67
developers are also very interested in supporting as many targets as possible,
58
68
so if Wasmtime doesn't work on your platform yet we'd love to learn why and
59
69
what we can do to support that platform, but the conversation here is
@@ -77,7 +87,9 @@ raised about `#![no_std]`:
77
87
* Rust has no stable way to diagnose ` no_std ` errors in an otherwise ` std `
78
88
build, which means that to supoprt this feature it must be tested on CI with
79
89
a ` no_std ` target. This is costly in terms of CI time, CI maintenance, and
80
- developers having to do extra builds to avoid CI errors.
90
+ developers having to do extra builds to avoid CI errors. Note that this
91
+ isn't * more* costly than any other platform supported by Wasmtime, but it's
92
+ a cost nonetheless.
81
93
82
94
* Idioms in ` #![no_std] ` are quite different than normal Rust code. You'll
83
95
import from different crates (` core ` instead of ` std ` ) and data structures
@@ -94,6 +106,11 @@ raised about `#![no_std]`:
94
106
the costs associated so we can plan accordingly. Effectively we need to have
95
107
a goal in mind instead of taking on the costs of ` #![no_std] ` blindly.
96
108
109
+ * At this time it's not clear whether ` #![no_std] ` will be needed long-term,
110
+ so eating short-term costs may not pay off in the long run. Features like
111
+ Cargo's [ ` -Z build-std ` ] [ zbuild-std ] may mean that ` #![no_std] ` is less and
112
+ less necessary over time.
113
+
97
114
* ** How can Wasmtime support ` #![no_std] ` if it uses X?** - Wasmtime as-is today
98
115
is not suitable for many ` #![no_std] ` contexts. For example it might use
99
116
` mmap ` for allocating JIT code memory, leverage threads for caching, or use
@@ -107,3 +124,16 @@ raised about `#![no_std]`:
107
124
today look like it won't support ` #![no_std] ` , but this is almost always
108
125
simply a matter of time and development priorities rather than a fundamental
109
126
reason why Wasmtime * couldn't* support ` #![no_std] ` .
127
+
128
+ Note that at this time these guidelines apply not only to Wasmtime but also to
129
+ some of its dependencies developed by the Bytecode Alliance such as the
130
+ [ wasm-tools repository] ( https://github.com/bytecodealliance/wasm-tools ) . These
131
+ projects don't have the same runtime requirements as Wasmtime (e.g. ` wasmparser `
132
+ doesn't need ` mmap ` ), but we're following the same guidelines above at this
133
+ time. Patches to add ` #![no_std] ` , while possibly small, incur many of the same
134
+ costs and also have an unclear longevity as features like [ `-Z
135
+ build-std`] [ zbuild-std ] evolve.
136
+
137
+ [ zbuild-std ] : https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std
138
+ [ custom-target ] : https://doc.rust-lang.org/rustc/targets/custom.html
139
+ [ rust-lang/rust#74033 ] : https://github.com/rust-lang/rust/pull/74033
0 commit comments