From e434ff5f6ecefc9d0653beadac20bd412d5cc3aa Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sun, 20 Apr 2025 19:23:35 +0900 Subject: [PATCH] basic wasip2 support --- .cspell.dict/rust-more.txt | 2 ++ common/src/lib.rs | 1 + src/lib.rs | 2 ++ stdlib/src/lib.rs | 2 ++ 4 files changed, 7 insertions(+) diff --git a/.cspell.dict/rust-more.txt b/.cspell.dict/rust-more.txt index e92f1ff8c..e5d5ac86c 100644 --- a/.cspell.dict/rust-more.txt +++ b/.cspell.dict/rust-more.txt @@ -74,6 +74,8 @@ unic unistd unraw unsync +wasip1 +wasip2 wasmbind wasmtime widestring diff --git a/common/src/lib.rs b/common/src/lib.rs index a62c9517b..a66d3ad9c 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,5 +1,6 @@ //! A crate to hold types and functions common to all rustpython components. +#![cfg_attr(all(target_os = "wasi", target_env = "p2"), feature(wasip2))] #![cfg_attr(target_os = "redox", feature(byte_slice_trim_ascii, new_uninit))] #[macro_use] diff --git a/src/lib.rs b/src/lib.rs index e9c9c9129..262904c1c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,6 +35,8 @@ //! //! The binary will have all the standard arguments of a python interpreter (including a REPL!) but //! it will have your modules loaded into the vm. + +#![cfg_attr(all(target_os = "wasi", target_env = "p2"), feature(wasip2))] #![allow(clippy::needless_doctest_main)] #[macro_use] diff --git a/stdlib/src/lib.rs b/stdlib/src/lib.rs index 1e81606f3..ed35b4db7 100644 --- a/stdlib/src/lib.rs +++ b/stdlib/src/lib.rs @@ -1,6 +1,8 @@ // to allow `mod foo {}` in foo.rs; clippy thinks this is a mistake/misunderstanding of // how `mod` works, but we want this sometimes for pymodule declarations + #![allow(clippy::module_inception)] +#![cfg_attr(all(target_os = "wasi", target_env = "p2"), feature(wasip2))] #![cfg_attr(target_os = "redox", feature(raw_ref_op))] #[macro_use]