Skip to content

Commit 0b6efe8

Browse files
committed
Add wasi-preview2 os module
Signed-off-by: Ryan Levick <[email protected]>
1 parent 77b58c0 commit 0b6efe8

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

library/std/src/os/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ pub mod linux;
8282
all(target_vendor = "fortanix", target_env = "sgx")
8383
)
8484
)))]
85-
#[cfg(any(target_os = "wasi", target_os = "wasi-preview2", doc))]
85+
#[cfg(any(target_family = "wasi", doc))]
8686
pub mod wasi;
8787

88+
#[cfg(any(target_os = "wasi-preview2", doc))]
89+
pub mod wasi_preview2;
90+
8891
// windows
8992
#[cfg(not(all(
9093
doc,
@@ -155,7 +158,7 @@ pub(crate) mod watchos;
155158
#[cfg(target_os = "xous")]
156159
pub mod xous;
157160

158-
#[cfg(any(unix, target_os = "wasi", target_os = "wasi-preview2", doc))]
161+
#[cfg(any(unix, target_family = "wasi", doc))]
159162
pub mod fd;
160163

161164
#[cfg(any(target_os = "linux", target_os = "android", doc))]
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//! Platform-specific extensions to `std` for Preview 2 of the WebAssembly System Interface (WASI).
2+
//!
3+
//! This module is currently empty, but will be filled over time as wasi-libc support for WASI Preview 2 is stabilized.
4+
5+
#![stable(feature = "raw_ext", since = "1.1.0")]

src/bootstrap/src/core/build_steps/compile.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ fn copy_self_contained_objects(
343343
let srcdir = builder
344344
.wasi_root(target)
345345
.unwrap_or_else(|| {
346-
panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
346+
panic!(
347+
"Target {:?} does not have a \"wasi-root\" key in Config.toml",
348+
target.triple
349+
)
347350
})
348351
.join("lib")
349352
.join(target.to_string().replace("-preview1", "").replace("-preview2", ""));

0 commit comments

Comments
 (0)