Skip to content

Commit

Permalink
Added a warning for #4132
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Aug 7, 2023
1 parent 9d98b30 commit 3c2d6bf
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 14 deletions.
9 changes: 4 additions & 5 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[build]
# This is needed so the module is compiled with atomics support (shared memory)
rustflags = '-Ctarget-feature=+atomics,+bulk-memory'

[target.wasm32-unknown-unknown]
[target.'cfg(target_arch = "wasm32")']
# Use "wasmer" for running tests when compiled to WebAssembly
runner = ["wasmer", "run"]
# This is needed so the module is compiled with atomics support (shared memory)
# We add the `-no-check-features` linker args because otherwise one of the modules fails to link
rustflags = '-Ctarget-feature=+atomics,+bulk-memory -Clink-args=--no-check-features'

[unstable]
# We want to make sure std gets built with atomics, too
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/wasix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ sys-thread = ["tokio/rt", "tokio/time", "tokio/rt-multi-thread", "rayon"]
# Deprecated. Kept it for compatibility
compiler = []

js = [
"virtual-fs/no-time", "virtual-net/remote", "getrandom/js", "chrono",
"wasm-bindgen-futures", "wasm-bindgen", "js-sys", "web-sys", "base64"
]
js = ["virtual-fs/no-time", "virtual-net/remote", "getrandom/js", "chrono", "wasm-bindgen-futures", "wasm-bindgen", "js-sys", "web-sys", "base64"]
js-default = ["js"]
test-js = ["js", "wasmer/wat"]

Expand All @@ -164,6 +161,9 @@ logging = ["tracing/log"]
disable-all-logging = ["tracing/release_max_level_off", "tracing/max_level_off"]
enable-serde = ["typetag", "virtual-fs/enable-serde", "wasmer-wasix-types/enable-serde"]

[build-dependencies]
rustc_version = "0.4.0"

[package.metadata.docs.rs]
features = [
"wasmer/sys", "webc_runner_rt_wcgi",
Expand Down
28 changes: 28 additions & 0 deletions lib/wasix/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::process::{Command, Stdio};

use rustc_version::{Channel, VersionMeta};

fn main() {
if std::env::var("CARGO_FEATURE_JS").is_ok() {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".to_string());
let mut cmd = Command::new(rustc);
cmd.stdout(Stdio::piped())
.stderr(Stdio::piped())
.current_dir(env!("CARGO_MANIFEST_DIR"));

let VersionMeta {
channel,
short_version_string,
..
} = VersionMeta::for_command(cmd).unwrap();

if channel != Channel::Nightly {
println!(
"cargo:warning={} was compiled with {short_version_string}, \
but the \"js\" feature requires nightly features. \
See https://github.com/wasmerio/wasmer/issues/4132 for more context.",
env!("CARGO_PKG_NAME"),
);
}
}
}
5 changes: 1 addition & 4 deletions lib/wasix/tests/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
//! API.
#![cfg(all(target_arch = "wasm32", feature = "js"))]

use std::{
sync::{Condvar, Mutex},
time::Duration,
};
use std::sync::{Condvar, Mutex};

use futures::channel::oneshot;
use wasmer_wasix::{
Expand Down
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

5 changes: 5 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "1.69"
components = ["rustfmt", "rust-src", "clippy"]
targets = ["wasm32-unknown-unknown"]
profile = "minimal"

0 comments on commit 3c2d6bf

Please sign in to comment.