Skip to content

Commit

Permalink
Auto merge of rust-lang#110596 - yoshuawuyts:rename-wasm32-wasi, r=<try>
Browse files Browse the repository at this point in the history
Rename `wasm32-wasi` to `wasm32-wasi-preview1`

Implements rust-lang/compiler-team#607
  • Loading branch information
bors committed Jul 5, 2023
2 parents dfe0683 + 07241ee commit 4583ef2
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 25 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ supported_targets! {
("asmjs-unknown-emscripten", asmjs_unknown_emscripten),
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
("wasm32-unknown-unknown", wasm32_unknown_unknown),
("wasm32-wasi", wasm32_wasi),
("wasm32-wasi-preview1", wasm32_wasi_preview1),
("wasm64-unknown-unknown", wasm64_unknown_unknown),

("thumbv6m-none-eabi", thumbv6m_none_eabi),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The `wasm32-wasi` target is a new and still (as of April 2019) an
//! The `wasm32-wasi-preview1` target is a new and still (as of April 2019) an
//! experimental target. The definition in this file is likely to be tweaked
//! over time and shouldn't be relied on too much.
//!
Expand All @@ -13,12 +13,12 @@
//! serve two use cases here with this target:
//!
//! * First, we want Rust usage of the target to be as hassle-free as possible,
//! ideally avoiding the need to configure and install a local wasm32-wasi
//! ideally avoiding the need to configure and install a local wasm32-wasi-preview1
//! toolchain.
//!
//! * Second, one of the primary use cases of LLVM's new wasm backend and the
//! wasm support in LLD is that any compiled language can interoperate with
//! any other. To that the `wasm32-wasi` target is the first with a viable C
//! any other. To that the `wasm32-wasi-preview1` target is the first with a viable C
//! standard library and sysroot common definition, so we want Rust and C/C++
//! code to interoperate when compiled to `wasm32-unknown-unknown`.
//!
Expand All @@ -39,7 +39,7 @@
//! necessary.
//!
//! All in all, by default, no external dependencies are required. You can
//! compile `wasm32-wasi` binaries straight out of the box. You can't, however,
//! compile `wasm32-wasi-preview1` binaries straight out of the box. You can't, however,
//! reliably interoperate with C code in this mode (yet).
//!
//! ## Interop with C required
Expand All @@ -53,7 +53,7 @@
//!
//! 2. If you're using rustc to build a linked artifact then you'll need to
//! specify `-C linker` to a `clang` binary that supports
//! `wasm32-wasi` and is configured with the `wasm32-wasi` sysroot. This
//! `wasm32-wasi-preview1` and is configured with the `wasm32-wasi-preview1` sysroot. This
//! will cause Rust code to be linked against the libc.a that the specified
//! `clang` provides.
//!
Expand Down
6 changes: 3 additions & 3 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,9 @@ changelog-seen = 2
# The full path to the musl libdir.
#musl-libdir = musl-root/lib

# The root location of the `wasm32-wasi` sysroot. Only used for the
# `wasm32-wasi` target. If you are building wasm32-wasi target, make sure to
# create a `[target.wasm32-wasi]` section and move this field there.
# The root location of the `wasm32-wasi-preview1` sysroot. Only used for the
# `wasm32-wasi-preview1` target. If you are building wasm32-wasi-preview1 target, make sure to
# create a `[target.wasm32-wasi-preview1]` section and move this field there.
#wasi-root = <none> (path)

# Used in testing for configuring where the QEMU images are located, you
Expand Down
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fortanix-sgx-abi = { version = "0.5.0", features = ['rustc-dep-of-std'], public
[target.'cfg(target_os = "hermit")'.dependencies]
hermit-abi = { version = "0.3.0", features = ['rustc-dep-of-std'] }

[target.wasm32-wasi.dependencies]
[target.wasm32-wasi-preview1.dependencies]
wasi = { version = "0.11.0", features = ['rustc-dep-of-std'], default-features = false }

[features]
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/os/wasi/io/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// As a result, the items in os::fd::raw were given the
// rustc_allowed_through_unstable_modules attribute.
// No regression tests were added to ensure this property,
// as CI is not configured to test wasm32-wasi.
// as CI is not configured to test wasm32-wasi-preview1.
// If this module is stabilized,
// you may want to remove those attributes
// (assuming no other unstable modules need them).
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ fn copy_self_contained_objects(
.unwrap_or_else(|| {
panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
})
.join("lib/wasm32-wasi");
.join("lib/wasm32-wasi-preview1");
for &obj in &["libc.a", "crt1-command.o", "crt1-reactor.o"] {
copy_and_stamp(
builder,
Expand Down Expand Up @@ -408,7 +408,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car

if target.ends_with("-wasi") {
if let Some(p) = builder.wasi_root(target) {
let root = format!("native={}/lib/wasm32-wasi", p.to_str().unwrap());
let root = format!("native={}/lib/wasm32-wasi-preview1", p.to_str().unwrap());
cargo.rustflag("-L").rustflag(&root);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ impl Step for CompiletestTest {
&[],
);
cargo.allow_features("test");
cargo.env("RUSTC_STAGE", builder.top_stage.to_string());
run_cargo_test(cargo, &[], &[], "compiletest", compiler, host, builder);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ci/docker/host-x86_64/dist-various-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_RUSTFLAGS \
ENV TARGETS=x86_64-unknown-fuchsia
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
ENV TARGETS=$TARGETS,wasm32-wasi
ENV TARGETS=$TARGETS,wasm32-wasi-preview1
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
ENV TARGETS=$TARGETS,x86_64-pc-solaris
ENV TARGETS=$TARGETS,x86_64-sun-solaris
Expand All @@ -135,7 +135,7 @@ ENV TARGETS=$TARGETS,x86_64-unknown-uefi
RUN ln -s /usr/include/asm-generic /usr/local/include/asm

ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \
--set target.wasm32-wasi.wasi-root=/wasm32-wasi \
--set target.wasm32-wasi-preview1.wasi-root=/wasm32-wasi-preview1 \
--musl-root-armv7=/musl-armv7

ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ make -j$(nproc) \
CC="$bin/clang" \
NM="$bin/llvm-nm" \
AR="$bin/llvm-ar" \
INSTALL_DIR=/wasm32-wasi \
INSTALL_DIR=/wasm32-wasi-preview1 \
install

cd ..
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ target | std | notes
`thumbv8m.main-none-eabihf` | * | Bare ARMv8-M Mainline, hardfloat
`wasm32-unknown-emscripten` | ✓ | WebAssembly via Emscripten
`wasm32-unknown-unknown` | ✓ | WebAssembly
`wasm32-wasi` | ✓ | WebAssembly with WASI
`wasm32-wasi-preview1` | ✓ | WebAssembly with WASI Preview 1
`x86_64-apple-ios` | ✓ | 64-bit x86 iOS
[`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
`x86_64-fuchsia` | ✓ | Alias for `x86_64-unknown-fuchsia`
Expand Down
2 changes: 1 addition & 1 deletion src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static TARGETS: &[&str] = &[
"thumbv8m.main-none-eabihf",
"wasm32-unknown-emscripten",
"wasm32-unknown-unknown",
"wasm32-wasi",
"wasm32-wasi-preview1",
"x86_64-apple-darwin",
"x86_64-apple-ios",
"x86_64-fortanix-unknown-sgx",
Expand Down
28 changes: 23 additions & 5 deletions src/tools/compiletest/src/header/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ fn pointer_width() {

#[test]
fn wasm_special() {
let ignores = [
let mut ignores = vec![
("wasm32-unknown-unknown", "emscripten", true),
("wasm32-unknown-unknown", "wasm32", true),
("wasm32-unknown-unknown", "wasm32-bare", true),
Expand All @@ -446,15 +446,33 @@ fn wasm_special() {
("wasm32-unknown-emscripten", "emscripten", true),
("wasm32-unknown-emscripten", "wasm32", true),
("wasm32-unknown-emscripten", "wasm32-bare", false),
("wasm32-wasi", "emscripten", false),
("wasm32-wasi", "wasm32", true),
("wasm32-wasi", "wasm32-bare", false),
("wasm32-wasi", "wasi", true),
("wasm64-unknown-unknown", "emscripten", false),
("wasm64-unknown-unknown", "wasm32", false),
("wasm64-unknown-unknown", "wasm32-bare", false),
("wasm64-unknown-unknown", "wasm64", true),
];

// FIXME(yosh): We're updating the "wasm32-wasi" target name to "wasm32-wasi-preview1".
// The MinGW tests run a beta compiler on stage 0 which means we're having a target mismatch
// for a brief period. When a new beta release is cut, the `if` part of this conditional should be
// removed, and the `else` part should be re-inlined in the original `ignores` list.
// cfg(bootstrap)
if env!("RUSTC_STAGE") == "0" {
ignores.append(&mut vec![
("wasm32-wasi", "emscripten", false),
("wasm32-wasi", "wasm32", true),
("wasm32-wasi", "wasm32-bare", false),
("wasm32-wasi", "wasi", true),
]);
} else {
ignores.append(&mut vec![
("wasm32-wasi-preview1", "emscripten", false),
("wasm32-wasi-preview1", "wasm32", true),
("wasm32-wasi-preview1", "wasm32-bare", false),
("wasm32-wasi-preview1", "wasi", true),
]);
}

for (target, pattern, ignore) in ignores {
let mut config = config();
config.target = target.to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ case $HOST_TARGET in
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple atomic data_race env/var
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings
MIRI_TEST_TARGET=wasm32-wasi-preview1 run_tests_minimal no_std integer strings
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings
MIRI_TEST_TARGET=thumbv7em-none-eabihf MIRI_NO_STD=1 run_tests_minimal no_std # no_std embedded architecture
MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std # JSON target file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
// [r71] needs-llvm-components: webassembly
// [r72] compile-flags:--target wasm32-unknown-unknown
// [r72] needs-llvm-components: webassembly
// [r73] compile-flags:--target wasm32-wasi
// [r73] compile-flags:--target wasm32-wasi-preview1
// [r73] needs-llvm-components: webassembly
// [r74] compile-flags:--target x86_64-apple-ios
// [r74] needs-llvm-components: x86
Expand Down

0 comments on commit 4583ef2

Please sign in to comment.