Skip to content

Commit 173bfff

Browse files
author
Denys Zadorozhnyi
committed
chore: switch from wasm32-wasi to wasm32-wasip1 target
In rust 1.78 `wasm32-wasi` target is renamed to `wasm32-wasip1`. See https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
1 parent 5c098e7 commit 173bfff

6 files changed

Lines changed: 27 additions & 23 deletions

File tree

Makefile.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ args = ["target", "add", "wasm32-unknown-unknown"]
200200
category = "Test"
201201
description = "Install wasm32-wasi target"
202202
command = "rustup"
203-
args = ["target", "add", "wasm32-wasi"]
203+
# `wasm32-wasi` target is renamed to `wasm32-wasip1`
204+
# https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
205+
args = ["target", "add", "wasm32-wasip1"]
204206

205207
[tasks.install-rust-src]
206208
category = "Test"

sdk/.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[build]
2-
target = "wasm32-wasi"
2+
target = "wasm32-wasip1"

tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.hir

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2908,6 +2908,14 @@
29082908
(block 1)
29092909
)
29102910

2911+
(func (export #core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail)
2912+
(param i32) (param i32) (param i32)
2913+
(block 0 (param v0 i32) (param v1 i32) (param v2 i32)
2914+
(unreachable))
2915+
2916+
(block 1)
2917+
)
2918+
29112919
(func (export #core::slice::<impl [T]>::copy_from_slice)
29122920
(param i32) (param i32) (param i32) (param i32) (param i32)
29132921
(block 0
@@ -2936,14 +2944,6 @@
29362944
(ret))
29372945
)
29382946

2939-
(func (export #core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail)
2940-
(param i32) (param i32) (param i32)
2941-
(block 0 (param v0 i32) (param v1 i32) (param v2 i32)
2942-
(unreachable))
2943-
2944-
(block 1)
2945-
)
2946-
29472947
(func (export #get_wallet_magic_number.command_export) (result felt)
29482948
(block 0
29492949
(let (v1 felt) (call #get_wallet_magic_number))

tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.wat

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,11 @@
17781778
unreachable
17791779
unreachable
17801780
)
1781-
(func $core::slice::<impl [T]>::copy_from_slice (;64;) (type 27) (param i32 i32 i32 i32 i32)
1781+
(func $core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail (;64;) (type 19) (param i32 i32 i32)
1782+
unreachable
1783+
unreachable
1784+
)
1785+
(func $core::slice::<impl [T]>::copy_from_slice (;65;) (type 27) (param i32 i32 i32 i32 i32)
17821786
block ;; label = @1
17831787
local.get 1
17841788
local.get 3
@@ -1796,10 +1800,6 @@
17961800
call $core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail
17971801
unreachable
17981802
)
1799-
(func $core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail (;65;) (type 19) (param i32 i32 i32)
1800-
unreachable
1801-
unreachable
1802-
)
18031803
(func $get_wallet_magic_number.command_export (;66;) (type 11) (result f32)
18041804
call $get_wallet_magic_number
18051805
call $__wasm_call_dtors

tests/integration/src/compiler_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ use crate::cargo_proj::project;
2323

2424
type LinkMasmModules = Vec<(LibraryPath, String)>;
2525

26+
pub const WASM32_WASI_TARGET: &str = "wasm32-wasip1";
27+
2628
pub enum CompilerTestSource {
2729
Rust(String),
2830
RustCargo {
@@ -213,7 +215,7 @@ impl CompilerTest {
213215
.arg("--manifest-path")
214216
.arg(manifest_path)
215217
.arg("--release")
216-
.arg("--target=wasm32-wasi");
218+
.arg(format!("--target={}", WASM32_WASI_TARGET));
217219
if is_build_std {
218220
// compile std as part of crate graph compilation
219221
// https://doc.rust-lang.org/cargo/reference/unstable.html#build-std
@@ -630,7 +632,7 @@ fn wasm_artifact_path(cargo_project_folder: &Path, artifact_name: &str) -> PathB
630632
cargo_project_folder
631633
.to_path_buf()
632634
.join("target")
633-
.join("wasm32-wasi")
635+
.join(WASM32_WASI_TARGET)
634636
.join("release")
635637
.join(artifact_name)
636638
.with_extension("wasm")

tools/cargo-miden/src/target.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ use std::{
66

77
use anyhow::{bail, Result};
88

9-
pub const WASM32_WASI_TARGET: &str = "wasm32-wasi";
9+
pub const WASM32_WASI_TARGET: &str = "wasm32-wasip1";
1010

1111
pub fn install_wasm32_wasi() -> Result<()> {
1212
log::info!("Installing {WASM32_WASI_TARGET} target");
1313
let sysroot = get_sysroot()?;
14-
if sysroot.join("lib/rustlib/wasm32-wasi").exists() {
14+
if sysroot.join(format!("lib/rustlib/{}", WASM32_WASI_TARGET)).exists() {
1515
return Ok(());
1616
}
1717

1818
if env::var_os("RUSTUP_TOOLCHAIN").is_none() {
1919
bail!(
20-
"failed to find the `wasm32-wasi` target and `rustup` is not available. If you're \
21-
using rustup make sure that it's correctly installed; if not, make sure to install \
22-
the `wasm32-wasi` target before using this command"
20+
"failed to find the `{WASM32_WASI_TARGET}` target and `rustup` is not available. If \
21+
you're using rustup make sure that it's correctly installed; if not, make sure to \
22+
install the `{WASM32_WASI_TARGET}` target before using this command",
2323
);
2424
}
2525

@@ -32,7 +32,7 @@ pub fn install_wasm32_wasi() -> Result<()> {
3232
.output()?;
3333

3434
if !output.status.success() {
35-
bail!("failed to install the `wasm32-wasi` target");
35+
bail!("failed to install the `{WASM32_WASI_TARGET}` target");
3636
}
3737

3838
Ok(())

0 commit comments

Comments
 (0)