From a227bc7ee912d20146aaebc2de5d9bb8aa29665e Mon Sep 17 00:00:00 2001 From: ginnyTheCat Date: Thu, 26 Mar 2026 17:42:08 +0100 Subject: [PATCH 1/7] Make std::fs::File Send on UEFI --- library/std/src/sys/fs/uefi.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/std/src/sys/fs/uefi.rs b/library/std/src/sys/fs/uefi.rs index 8135519317a02..ef523a9807f1c 100644 --- a/library/std/src/sys/fs/uefi.rs +++ b/library/std/src/sys/fs/uefi.rs @@ -588,6 +588,11 @@ mod uefi_fs { path: crate::path::PathBuf, } + // SAFETY: UEFI has no regular threads, and as per + // std does not support being invoked from "irregular threads" such as interrupt handlers or other + // CPU cores that run outside the scope of UEFI. + unsafe impl Send for File {} + impl File { pub(crate) fn from_path(path: &Path, open_mode: u64, attr: u64) -> io::Result { let absolute = crate::path::absolute(path)?; From dc36b8e3c2f767d0ea3cd3e79c748119fa80e210 Mon Sep 17 00:00:00 2001 From: ArshLabs Date: Sun, 12 Apr 2026 12:34:29 +0530 Subject: [PATCH 2/7] std: fix HashMap RNG docs wording --- library/std/src/collections/hash/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index 4192254f6c824..4d190d90ca73d 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -20,7 +20,7 @@ use crate::ops::Index; /// reasonable best-effort is made to generate this seed from a high quality, /// secure source of randomness provided by the host without blocking the /// program. Because of this, the randomness of the seed depends on the output -/// quality of the system's random number coroutine when the seed is created. +/// quality of the system's random number generator when the seed is created. /// In particular, seeds generated when the system's entropy pool is abnormally /// low such as during system boot may be of a lower quality. /// From b9ec55bbcdf72480bda11bba5b2151b6376b3897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 12 Apr 2026 18:00:56 +0200 Subject: [PATCH 3/7] Document why `layout.align() + layout.size()` doesn't overflow --- library/std/src/sys/alloc/windows.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/std/src/sys/alloc/windows.rs b/library/std/src/sys/alloc/windows.rs index 90da0b7e9965c..9336a6ec085aa 100644 --- a/library/std/src/sys/alloc/windows.rs +++ b/library/std/src/sys/alloc/windows.rs @@ -118,6 +118,9 @@ unsafe fn allocate(layout: Layout, zeroed: bool) -> *mut u8 { process_heap_alloc(MaybeUninit::uninit(), flags, layout.size()) as *mut u8 } else { // Allocate extra padding in order to be able to satisfy the alignment. + // This addition does not overflow due to `Layout` type invariants, + // `size()` is at most `isize::MAX` while + // `align()` is at most `1 << (bits in usize - 2)` if `size()` is non-zero. let total = layout.align() + layout.size(); let ptr = process_heap_alloc(MaybeUninit::uninit(), flags, total) as *mut u8; From 4e4d268b63e5e2201e145bffa6056ed935da16b9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 14 Apr 2026 13:47:38 +0200 Subject: [PATCH 4/7] net::tcp/udp: fix docs about how set_nonblocking is implemented --- library/std/src/net/tcp.rs | 8 ++++---- library/std/src/net/udp.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/std/src/net/tcp.rs b/library/std/src/net/tcp.rs index dac568e419f3f..a8046a5541c51 100644 --- a/library/std/src/net/tcp.rs +++ b/library/std/src/net/tcp.rs @@ -582,8 +582,8 @@ impl TcpStream { /// to be retried, an error with kind [`io::ErrorKind::WouldBlock`] is /// returned. /// - /// On Unix platforms, calling this method corresponds to calling `fcntl` - /// `FIONBIO`. On Windows calling this method corresponds to calling + /// On most Unix platforms, calling this method corresponds to calling `ioctl` + /// `FIONBIO`. On Windows, calling this method corresponds to calling /// `ioctlsocket` `FIONBIO`. /// /// # Examples @@ -988,8 +988,8 @@ impl TcpListener { /// IO operation could not be completed and needs to be retried, an error /// with kind [`io::ErrorKind::WouldBlock`] is returned. /// - /// On Unix platforms, calling this method corresponds to calling `fcntl` - /// `FIONBIO`. On Windows calling this method corresponds to calling + /// On most Unix platforms, calling this method corresponds to calling `ioctl` + /// `FIONBIO`. On Windows, calling this method corresponds to calling /// `ioctlsocket` `FIONBIO`. /// /// # Examples diff --git a/library/std/src/net/udp.rs b/library/std/src/net/udp.rs index 5da6b38037f0e..cd925b9bdfdf8 100644 --- a/library/std/src/net/udp.rs +++ b/library/std/src/net/udp.rs @@ -786,8 +786,8 @@ impl UdpSocket { /// and needs to be retried, an error with kind /// [`io::ErrorKind::WouldBlock`] is returned. /// - /// On Unix platforms, calling this method corresponds to calling `fcntl` - /// `FIONBIO`. On Windows calling this method corresponds to calling + /// On most Unix platforms, calling this method corresponds to calling `ioctl` + /// `FIONBIO`. On Windows, calling this method corresponds to calling /// `ioctlsocket` `FIONBIO`. /// /// # Examples From 8c78c33aba5215c884b14349b11ae141c5c598c5 Mon Sep 17 00:00:00 2001 From: ujjwalVishwakarma2006 <2023ucs0116@iitjammu.ac.in> Date: Wed, 15 Apr 2026 23:46:29 +0530 Subject: [PATCH 5/7] Move test files from issues/ to appropriate subdirectories --- .../issue-45425.rs => higher-ranked/binop-lhs-hrtb-subtyping.rs} | 0 .../subtyping-both-lhs-and-rhs-in-add-impl.rs} | 0 .../issue-28839.rs => reborrow/reborrow-mutable-reference.rs} | 0 .../auxiliary/resolve-conflict-local-vs-glob-import-a.rs} | 0 .../auxiliary/resolve-conflict-local-vs-glob-import-b.rs} | 0 .../resolve-conflict-local-vs-glob-import.rs} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename tests/ui/{issues/issue-45425.rs => higher-ranked/binop-lhs-hrtb-subtyping.rs} (100%) rename tests/ui/{issues/issue-32008.rs => overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs} (100%) rename tests/ui/{issues/issue-28839.rs => reborrow/reborrow-mutable-reference.rs} (100%) rename tests/ui/{issues/auxiliary/issue-2316-a.rs => resolve/auxiliary/resolve-conflict-local-vs-glob-import-a.rs} (100%) rename tests/ui/{issues/auxiliary/issue-2316-b.rs => resolve/auxiliary/resolve-conflict-local-vs-glob-import-b.rs} (100%) rename tests/ui/{issues/issue-2316-c.rs => resolve/resolve-conflict-local-vs-glob-import.rs} (100%) diff --git a/tests/ui/issues/issue-45425.rs b/tests/ui/higher-ranked/binop-lhs-hrtb-subtyping.rs similarity index 100% rename from tests/ui/issues/issue-45425.rs rename to tests/ui/higher-ranked/binop-lhs-hrtb-subtyping.rs diff --git a/tests/ui/issues/issue-32008.rs b/tests/ui/overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs similarity index 100% rename from tests/ui/issues/issue-32008.rs rename to tests/ui/overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs diff --git a/tests/ui/issues/issue-28839.rs b/tests/ui/reborrow/reborrow-mutable-reference.rs similarity index 100% rename from tests/ui/issues/issue-28839.rs rename to tests/ui/reborrow/reborrow-mutable-reference.rs diff --git a/tests/ui/issues/auxiliary/issue-2316-a.rs b/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-a.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-2316-a.rs rename to tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-a.rs diff --git a/tests/ui/issues/auxiliary/issue-2316-b.rs b/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-b.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-2316-b.rs rename to tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-b.rs diff --git a/tests/ui/issues/issue-2316-c.rs b/tests/ui/resolve/resolve-conflict-local-vs-glob-import.rs similarity index 100% rename from tests/ui/issues/issue-2316-c.rs rename to tests/ui/resolve/resolve-conflict-local-vs-glob-import.rs From bcf86daadaf0430cac0dceff1b3a2dc4a4b72b0d Mon Sep 17 00:00:00 2001 From: ujjwalVishwakarma2006 <2023ucs0116@iitjammu.ac.in> Date: Wed, 15 Apr 2026 23:50:36 +0530 Subject: [PATCH 6/7] Add issue links --- tests/ui/higher-ranked/binop-lhs-hrtb-subtyping.rs | 1 + .../overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs | 1 + tests/ui/reborrow/reborrow-mutable-reference.rs | 1 + .../auxiliary/resolve-conflict-local-vs-glob-import-a.rs | 1 + .../auxiliary/resolve-conflict-local-vs-glob-import-b.rs | 5 +++-- .../ui/resolve/resolve-conflict-local-vs-glob-import.rs | 9 +++++---- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/ui/higher-ranked/binop-lhs-hrtb-subtyping.rs b/tests/ui/higher-ranked/binop-lhs-hrtb-subtyping.rs index fad8284caf5ba..9408bc120e1c7 100644 --- a/tests/ui/higher-ranked/binop-lhs-hrtb-subtyping.rs +++ b/tests/ui/higher-ranked/binop-lhs-hrtb-subtyping.rs @@ -1,3 +1,4 @@ +//! Regression test for //@ check-pass #![allow(dead_code)] use std::ops::Add; diff --git a/tests/ui/overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs b/tests/ui/overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs index 9075085bab746..7ec43607c2bca 100644 --- a/tests/ui/overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs +++ b/tests/ui/overloaded/subtyping-both-lhs-and-rhs-in-add-impl.rs @@ -1,3 +1,4 @@ +//! Regression test for //@ run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/tests/ui/reborrow/reborrow-mutable-reference.rs b/tests/ui/reborrow/reborrow-mutable-reference.rs index 76b0fa2d6e089..a66e4de34bcb0 100644 --- a/tests/ui/reborrow/reborrow-mutable-reference.rs +++ b/tests/ui/reborrow/reborrow-mutable-reference.rs @@ -1,3 +1,4 @@ +//! Regression test for //@ run-pass pub struct Foo; diff --git a/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-a.rs b/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-a.rs index 418ddc0b06926..3ce7e5f30836c 100644 --- a/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-a.rs +++ b/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-a.rs @@ -1,3 +1,4 @@ +//! Regression test for enum cat { tabby, calico, tortoiseshell } diff --git a/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-b.rs b/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-b.rs index 550c2d6eb226d..64fc45e21faf1 100644 --- a/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-b.rs +++ b/tests/ui/resolve/auxiliary/resolve-conflict-local-vs-glob-import-b.rs @@ -1,9 +1,10 @@ +//! Regression test for #![allow(unused_imports)] -extern crate issue_2316_a; +extern crate resolve_conflict_local_vs_glob_import_a; pub mod cloth { - use issue_2316_a::*; + use resolve_conflict_local_vs_glob_import_a::*; pub enum fabric { gingham, flannel, calico diff --git a/tests/ui/resolve/resolve-conflict-local-vs-glob-import.rs b/tests/ui/resolve/resolve-conflict-local-vs-glob-import.rs index f800d4723ffd2..eebab6509d738 100644 --- a/tests/ui/resolve/resolve-conflict-local-vs-glob-import.rs +++ b/tests/ui/resolve/resolve-conflict-local-vs-glob-import.rs @@ -1,10 +1,11 @@ +//! Regression test for //@ run-pass -//@ aux-build:issue-2316-a.rs -//@ aux-build:issue-2316-b.rs +//@ aux-build:resolve-conflict-local-vs-glob-import-a.rs +//@ aux-build:resolve-conflict-local-vs-glob-import-b.rs -extern crate issue_2316_b; -use issue_2316_b::cloth; +extern crate resolve_conflict_local_vs_glob_import_b; +use resolve_conflict_local_vs_glob_import_b::cloth; pub fn main() { let _c: cloth::fabric = cloth::fabric::calico; From 690be3e13c2d0447105cdb972f47e6047741c9c5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 16 Apr 2026 13:29:41 -0700 Subject: [PATCH 7/7] std: Update dependency on `wasi` crate This commit updates the crate dependency that the standard library has on the `wasi` crate. This is now updated to depending explicitly on the `wasip1` crate and the `wasip2` crate published on crates.io. These crates are managed in the [same location][repo] as the `wasi` crate and represent a different versioning scheme which doesn't require multi-version WASI support to require depending on the same crate at multiple versions. The code in libstd is updated to reference `wasip1` and `wasip2` directly as well. [repo]: https://github.com/bytecodealliance/wasi-rs --- library/Cargo.lock | 20 ++++---- library/std/Cargo.toml | 10 ++-- library/std/src/os/wasi/fs.rs | 48 +++++++++++--------- library/std/src/os/wasi/net/mod.rs | 2 +- library/std/src/sys/args/wasip1.rs | 4 +- library/std/src/sys/net/connection/wasip1.rs | 28 ++++++------ library/std/src/sys/pal/wasi/mod.rs | 2 +- library/std/src/sys/random/wasip1.rs | 2 +- src/tools/tidy/src/deps.rs | 8 ++-- 9 files changed, 65 insertions(+), 59 deletions(-) diff --git a/library/Cargo.lock b/library/Cargo.lock index d7227def0461d..834babacdb96f 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -344,8 +344,8 @@ dependencies = [ "std_detect", "unwind", "vex-sdk", - "wasi 0.11.1+wasi-snapshot-preview1", - "wasi 0.14.4+wasi-0.2.4", + "wasip1", + "wasip2", "windows-link 0.0.0", ] @@ -407,20 +407,20 @@ dependencies = [ ] [[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" +name = "wasip1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +checksum = "b5e26842486624357dbeb8f0381cf1fb42f022291fd787d4a816768fec8cc760" dependencies = [ "rustc-std-workspace-alloc", "rustc-std-workspace-core", ] [[package]] -name = "wasi" -version = "0.14.4+wasi-0.2.4" +name = "wasip2" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a5f4a424faf49c3c2c344f166f0662341d470ea185e939657aaff130f0ec4a" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ "rustc-std-workspace-alloc", "rustc-std-workspace-core", @@ -513,9 +513,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "wit-bindgen" -version = "0.45.1" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c573471f125075647d03df72e026074b7203790d41351cd6edc96f46bcccd36" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" dependencies = [ "rustc-std-workspace-alloc", "rustc-std-workspace-core", diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index a22ef6c6689c8..ebd09f31e25ab 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -79,19 +79,19 @@ hermit-abi = { version = "0.5.0", features = [ ], public = true } [target.'cfg(all(target_os = "wasi", target_env = "p1"))'.dependencies] -wasi = { version = "0.11.0", features = [ +wasip1 = { version = "1.0.0", features = [ 'rustc-dep-of-std', ], default-features = false } [target.'cfg(all(target_os = "wasi", target_env = "p2"))'.dependencies] -wasip2 = { version = '0.14.4', features = [ +wasip2 = { version = '1.0.2', features = [ 'rustc-dep-of-std', -], default-features = false, package = 'wasi' } +], default-features = false } [target.'cfg(all(target_os = "wasi", target_env = "p3"))'.dependencies] -wasip2 = { version = '0.14.4', features = [ +wasip2 = { version = '1.0.2', features = [ 'rustc-dep-of-std', -], default-features = false, package = 'wasi' } +], default-features = false } [target.'cfg(target_os = "uefi")'.dependencies] r-efi = { version = "5.2.0", features = ['rustc-dep-of-std'] } diff --git a/library/std/src/os/wasi/fs.rs b/library/std/src/os/wasi/fs.rs index 248112cb369dc..ffc8737df16f2 100644 --- a/library/std/src/os/wasi/fs.rs +++ b/library/std/src/os/wasi/fs.rs @@ -246,13 +246,15 @@ impl FileExt for File { #[cfg(target_env = "p1")] fn fdstat_set_flags(&self, flags: u16) -> io::Result<()> { - unsafe { wasi::fd_fdstat_set_flags(self.as_raw_fd() as wasi::Fd, flags).map_err(err2io) } + unsafe { + wasip1::fd_fdstat_set_flags(self.as_raw_fd() as wasip1::Fd, flags).map_err(err2io) + } } #[cfg(target_env = "p1")] fn fdstat_set_rights(&self, rights: u64, inheriting: u64) -> io::Result<()> { unsafe { - wasi::fd_fdstat_set_rights(self.as_raw_fd() as wasi::Fd, rights, inheriting) + wasip1::fd_fdstat_set_rights(self.as_raw_fd() as wasip1::Fd, rights, inheriting) .map_err(err2io) } } @@ -260,12 +262,12 @@ impl FileExt for File { #[cfg(target_env = "p1")] fn advise(&self, offset: u64, len: u64, advice: u8) -> io::Result<()> { let advice = match advice { - a if a == wasi::ADVICE_NORMAL.raw() => wasi::ADVICE_NORMAL, - a if a == wasi::ADVICE_SEQUENTIAL.raw() => wasi::ADVICE_SEQUENTIAL, - a if a == wasi::ADVICE_RANDOM.raw() => wasi::ADVICE_RANDOM, - a if a == wasi::ADVICE_WILLNEED.raw() => wasi::ADVICE_WILLNEED, - a if a == wasi::ADVICE_DONTNEED.raw() => wasi::ADVICE_DONTNEED, - a if a == wasi::ADVICE_NOREUSE.raw() => wasi::ADVICE_NOREUSE, + a if a == wasip1::ADVICE_NORMAL.raw() => wasip1::ADVICE_NORMAL, + a if a == wasip1::ADVICE_SEQUENTIAL.raw() => wasip1::ADVICE_SEQUENTIAL, + a if a == wasip1::ADVICE_RANDOM.raw() => wasip1::ADVICE_RANDOM, + a if a == wasip1::ADVICE_WILLNEED.raw() => wasip1::ADVICE_WILLNEED, + a if a == wasip1::ADVICE_DONTNEED.raw() => wasip1::ADVICE_DONTNEED, + a if a == wasip1::ADVICE_NOREUSE.raw() => wasip1::ADVICE_NOREUSE, _ => { return Err(io::const_error!( io::ErrorKind::InvalidInput, @@ -275,31 +277,35 @@ impl FileExt for File { }; unsafe { - wasi::fd_advise(self.as_raw_fd() as wasi::Fd, offset, len, advice).map_err(err2io) + wasip1::fd_advise(self.as_raw_fd() as wasip1::Fd, offset, len, advice).map_err(err2io) } } #[cfg(target_env = "p1")] fn allocate(&self, offset: u64, len: u64) -> io::Result<()> { - unsafe { wasi::fd_allocate(self.as_raw_fd() as wasi::Fd, offset, len).map_err(err2io) } + unsafe { wasip1::fd_allocate(self.as_raw_fd() as wasip1::Fd, offset, len).map_err(err2io) } } #[cfg(target_env = "p1")] fn create_directory>(&self, dir: P) -> io::Result<()> { let path = osstr2str(dir.as_ref().as_ref())?; - unsafe { wasi::path_create_directory(self.as_raw_fd() as wasi::Fd, path).map_err(err2io) } + unsafe { + wasip1::path_create_directory(self.as_raw_fd() as wasip1::Fd, path).map_err(err2io) + } } #[cfg(target_env = "p1")] fn remove_file>(&self, path: P) -> io::Result<()> { let path = osstr2str(path.as_ref().as_ref())?; - unsafe { wasi::path_unlink_file(self.as_raw_fd() as wasi::Fd, path).map_err(err2io) } + unsafe { wasip1::path_unlink_file(self.as_raw_fd() as wasip1::Fd, path).map_err(err2io) } } #[cfg(target_env = "p1")] fn remove_directory>(&self, path: P) -> io::Result<()> { let path = osstr2str(path.as_ref().as_ref())?; - unsafe { wasi::path_remove_directory(self.as_raw_fd() as wasi::Fd, path).map_err(err2io) } + unsafe { + wasip1::path_remove_directory(self.as_raw_fd() as wasip1::Fd, path).map_err(err2io) + } } } @@ -388,11 +394,11 @@ pub fn link, U: AsRef>( new_path: U, ) -> io::Result<()> { unsafe { - wasi::path_link( - old_fd.as_raw_fd() as wasi::Fd, + wasip1::path_link( + old_fd.as_raw_fd() as wasip1::Fd, old_flags, osstr2str(old_path.as_ref().as_ref())?, - new_fd.as_raw_fd() as wasi::Fd, + new_fd.as_raw_fd() as wasip1::Fd, osstr2str(new_path.as_ref().as_ref())?, ) .map_err(err2io) @@ -411,10 +417,10 @@ pub fn rename, U: AsRef>( new_path: U, ) -> io::Result<()> { unsafe { - wasi::path_rename( - old_fd.as_raw_fd() as wasi::Fd, + wasip1::path_rename( + old_fd.as_raw_fd() as wasip1::Fd, osstr2str(old_path.as_ref().as_ref())?, - new_fd.as_raw_fd() as wasi::Fd, + new_fd.as_raw_fd() as wasip1::Fd, osstr2str(new_path.as_ref().as_ref())?, ) .map_err(err2io) @@ -432,9 +438,9 @@ pub fn symlink, U: AsRef>( new_path: U, ) -> io::Result<()> { unsafe { - wasi::path_symlink( + wasip1::path_symlink( osstr2str(old_path.as_ref().as_ref())?, - fd.as_raw_fd() as wasi::Fd, + fd.as_raw_fd() as wasip1::Fd, osstr2str(new_path.as_ref().as_ref())?, ) .map_err(err2io) diff --git a/library/std/src/os/wasi/net/mod.rs b/library/std/src/os/wasi/net/mod.rs index 9430cd3b05eee..fd5889bf9b7b5 100644 --- a/library/std/src/os/wasi/net/mod.rs +++ b/library/std/src/os/wasi/net/mod.rs @@ -18,6 +18,6 @@ pub trait TcpListenerExt { impl TcpListenerExt for net::TcpListener { fn sock_accept(&self, flags: u16) -> io::Result { - unsafe { wasi::sock_accept(self.as_raw_fd() as wasi::Fd, flags).map_err(err2io) } + unsafe { wasip1::sock_accept(self.as_raw_fd() as wasip1::Fd, flags).map_err(err2io) } } } diff --git a/library/std/src/sys/args/wasip1.rs b/library/std/src/sys/args/wasip1.rs index 72063a87dc9f5..c09175a23f50f 100644 --- a/library/std/src/sys/args/wasip1.rs +++ b/library/std/src/sys/args/wasip1.rs @@ -11,10 +11,10 @@ pub fn args() -> Args { fn maybe_args() -> Option> { unsafe { - let (argc, buf_size) = wasi::args_sizes_get().ok()?; + let (argc, buf_size) = wasip1::args_sizes_get().ok()?; let mut argv = Vec::with_capacity(argc); let mut buf = Vec::with_capacity(buf_size); - wasi::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?; + wasip1::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?; argv.set_len(argc); let mut ret = Vec::with_capacity(argc); for ptr in argv { diff --git a/library/std/src/sys/net/connection/wasip1.rs b/library/std/src/sys/net/connection/wasip1.rs index 95a4ab2fbf0fd..d6c7e023e865d 100644 --- a/library/std/src/sys/net/connection/wasip1.rs +++ b/library/std/src/sys/net/connection/wasip1.rs @@ -125,12 +125,12 @@ impl TcpStream { pub fn shutdown(&self, how: Shutdown) -> io::Result<()> { let wasi_how = match how { - Shutdown::Read => wasi::SDFLAGS_RD, - Shutdown::Write => wasi::SDFLAGS_WR, - Shutdown::Both => wasi::SDFLAGS_RD | wasi::SDFLAGS_WR, + Shutdown::Read => wasip1::SDFLAGS_RD, + Shutdown::Write => wasip1::SDFLAGS_WR, + Shutdown::Both => wasip1::SDFLAGS_RD | wasip1::SDFLAGS_WR, }; - unsafe { wasi::sock_shutdown(self.socket().as_raw_fd() as _, wasi_how).map_err(err2io) } + unsafe { wasip1::sock_shutdown(self.socket().as_raw_fd() as _, wasi_how).map_err(err2io) } } pub fn duplicate(&self) -> io::Result { @@ -167,19 +167,20 @@ impl TcpStream { pub fn set_nonblocking(&self, state: bool) -> io::Result<()> { let fdstat = unsafe { - wasi::fd_fdstat_get(self.socket().as_inner().as_raw_fd() as wasi::Fd).map_err(err2io)? + wasip1::fd_fdstat_get(self.socket().as_inner().as_raw_fd() as wasip1::Fd) + .map_err(err2io)? }; let mut flags = fdstat.fs_flags; if state { - flags |= wasi::FDFLAGS_NONBLOCK; + flags |= wasip1::FDFLAGS_NONBLOCK; } else { - flags &= !wasi::FDFLAGS_NONBLOCK; + flags &= !wasip1::FDFLAGS_NONBLOCK; } unsafe { - wasi::fd_fdstat_set_flags(self.socket().as_inner().as_raw_fd() as wasi::Fd, flags) + wasip1::fd_fdstat_set_flags(self.socket().as_inner().as_raw_fd() as wasip1::Fd, flags) .map_err(err2io) } } @@ -221,7 +222,7 @@ impl TcpListener { pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> { let fd = unsafe { - wasi::sock_accept(self.as_inner().as_inner().as_raw_fd() as _, 0).map_err(err2io)? + wasip1::sock_accept(self.as_inner().as_inner().as_raw_fd() as _, 0).map_err(err2io)? }; Ok(( @@ -258,19 +259,20 @@ impl TcpListener { pub fn set_nonblocking(&self, state: bool) -> io::Result<()> { let fdstat = unsafe { - wasi::fd_fdstat_get(self.socket().as_inner().as_raw_fd() as wasi::Fd).map_err(err2io)? + wasip1::fd_fdstat_get(self.socket().as_inner().as_raw_fd() as wasip1::Fd) + .map_err(err2io)? }; let mut flags = fdstat.fs_flags; if state { - flags |= wasi::FDFLAGS_NONBLOCK; + flags |= wasip1::FDFLAGS_NONBLOCK; } else { - flags &= !wasi::FDFLAGS_NONBLOCK; + flags &= !wasip1::FDFLAGS_NONBLOCK; } unsafe { - wasi::fd_fdstat_set_flags(self.socket().as_inner().as_raw_fd() as wasi::Fd, flags) + wasip1::fd_fdstat_set_flags(self.socket().as_inner().as_raw_fd() as wasip1::Fd, flags) .map_err(err2io) } } diff --git a/library/std/src/sys/pal/wasi/mod.rs b/library/std/src/sys/pal/wasi/mod.rs index 6f60993509253..8ea26faca7e70 100644 --- a/library/std/src/sys/pal/wasi/mod.rs +++ b/library/std/src/sys/pal/wasi/mod.rs @@ -29,7 +29,7 @@ pub fn abort_internal() -> ! { #[inline] #[cfg(target_env = "p1")] -pub(crate) fn err2io(err: wasi::Errno) -> crate::io::Error { +pub(crate) fn err2io(err: wasip1::Errno) -> crate::io::Error { crate::io::Error::from_raw_os_error(err.raw().into()) } diff --git a/library/std/src/sys/random/wasip1.rs b/library/std/src/sys/random/wasip1.rs index d41da3751fc04..cb91575fe30ef 100644 --- a/library/std/src/sys/random/wasip1.rs +++ b/library/std/src/sys/random/wasip1.rs @@ -1,5 +1,5 @@ pub fn fill_bytes(bytes: &mut [u8]) { unsafe { - wasi::random_get(bytes.as_mut_ptr(), bytes.len()).expect("failed to generate random data") + wasip1::random_get(bytes.as_mut_ptr(), bytes.len()).expect("failed to generate random data") } } diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index b0730de771395..11569837fbfa6 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -539,7 +539,8 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[ "shlex", "unwinding", "vex-sdk", - "wasi", + "wasip1", + "wasip2", "windows-link", "windows-sys", "windows-targets", @@ -881,10 +882,7 @@ fn check_runtime_no_duplicate_dependencies(metadata: &Metadata, check: &mut Runn continue; } - // Skip the `wasi` crate here which the standard library explicitly - // depends on two version of (one for the `wasm32-wasip1` target and - // another for the `wasm32-wasip2` target). - if pkg.name.to_string() != "wasi" && !seen_pkgs.insert(&*pkg.name) { + if !seen_pkgs.insert(&*pkg.name) { check.error(format!( "duplicate package `{}` is not allowed for the standard library", pkg.name