Skip to content

Commit 9b754f2

Browse files
authored
Recommend using wasm32-wasip2 in Rust example (bytecodealliance#1067)
1 parent a780ad2 commit 9b754f2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ world host {
185185

186186
### Guest: Rust
187187

188-
The Rust compiler supports a native `wasm32-wasip1` target and can be added to
188+
The Rust compiler since version 1.82 supports a native `wasm32-wasip2` target and can be added to
189189
any `rustup`-based toolchain with:
190190

191191
```sh
192-
rustup target add wasm32-wasip1
192+
rustup target add wasm32-wasip2
193193
```
194194

195195
In order to compile a wasi dynamic library, the following must be added to the
@@ -244,17 +244,15 @@ generated code (which is probably also a bug in `wit-bindgen`), you can use
244244
This project can then be built with:
245245

246246
```sh
247-
cargo build --target wasm32-wasip1
248-
wasm-tools component new ./target/wasm32-wasip1/debug/my-project.wasm \
249-
-o my-component.wasm --adapt ./wasi_snapshot_preview1.reactor.wasm
247+
cargo build --target wasm32-wasip2
250248
```
251249

252-
This creates a `my-component.wasm` file which is suitable to execute in any
250+
This creates a `./target/wasm32-wasip2/debug/my-project.wasm` file which is suitable to execute in any
253251
component runtime. Using `wasm-tools` you can inspect the binary as well, for
254252
example inferring the WIT world that is the component:
255253

256254
```sh
257-
wasm-tools component wit my-component.wasm
255+
wasm-tools component wit ./target/wasm32-wasip2/debug/my-project.wasm
258256
# world my-component {
259257
# import print: func(msg: string)
260258
# export run: func()

0 commit comments

Comments
 (0)