about summary refs log tree commit diff
path: root/library/std/src/sys/pal/zkvm
AgeCommit message (Collapse)AuthorLines
2025-09-19Fix unsupported std::sys::threadThalia Archibald-2/+0
Fixes building std for any platform with an unsupported thread abstraction. This includes {aarch64,armv7,x86_64}-unknown-trusty and riscv32im-risc0-zkvm-elf, which explicitly include the unsupported module, and platforms with no PAL. Bug fix for PR 145177 (std: move thread into sys).
2025-08-26remove deprecated Error::description in implsMarijn Schouten-7/+1
2025-04-25Rollup merge of #140143 - thaliaarchi:move-env-pal, r=joboetMatthias Krüger-61/+1
Move `sys::pal::os::Env` into `sys::env` Although `Env` (as `Vars`), `Args`, path functions, and OS constants are publicly exposed via `std::env`, their implementations are each self-contained. Keep them separate in `std::sys` and make a new module, `sys::env`, for `Env`. Also fix `unsafe_op_in_unsafe_fn` for Unix and update the `!DynSend` and `!DynSync` impls which had grown out of sync with the platforms (see #48005 for discussion on that). r? joboet Tracked in #117276.
2025-04-21Move zkVM constants into `sys::env_consts`Thalia Archibald-9/+0
I missed this in #139868. Its `mod` declaration was removed, but the contents were not moved.
2025-04-21Move `sys::pal::os::Env` into `sys::env`Thalia Archibald-61/+1
Although `Env` (as `Vars`), `Args`, path functions, and OS constants are publicly exposed via `std::env`, their implementations are each self-contained. Keep them separate in `std::sys` and make a new module, `sys::env`, for `Env`.
2025-04-18Combine env consts into std::sys::env_constsThalia Archibald-1/+0
2025-04-12Move args into std::sysThalia Archibald-84/+1
2025-03-22std: move process implementations to `sys`joboet-2/+0
As per #117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
2025-03-09std: move stdio to `sys`joboet-74/+0
As per #117276, this moves the platform definitions of `Stdout` and friends into `sys`. This PR also unifies the UNIX and Hermit implementations and moves the `__rust_print_err` function needed by libunwind on SGX into the dedicated module for such helper functions.
2025-03-08Move fs into sysThalia Archibald-2/+0
2025-03-06library: Use size_of from the prelude instead of importedThalia Archibald-1/+1
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-02-20Implement read_buf for zkVM stdinThalia Archibald-1/+9
For the zkVM, even when a guest buffer is uninitialized, from the host's perspective it is just a normal piece of memory which was initialized before letting the guest write into it. This makes `sys_read` safe to use with an uninitialized buffer. See https://github.com/risc0/risc0/issues/2853.
2025-02-09Mark extern blocks as unsafeMichael Goulet-1/+1
2025-02-07std: get rid of `sys_common::io`joboet-1/+1
2025-02-07std: move `io` module out of `pal`joboet-2/+0
2025-02-02std: move network code into `sys`joboet-2/+0
As per #117276, this PR moves `sys_common::net` and the `sys::pal::net` into the newly created `sys::net` module. In order to support #135141, I've moved all the current network code into a separate `connection` module, future functions like `hostname` can live in separate modules. I'll probably do a follow-up PR and clean up some of the actual code, this is mostly just a reorganization.
2024-11-26std: update internal uses of `io::const_error!`joboet-2/+2
2024-09-23std: implement the `random` featurejoboet-8/+0
Implements the ACP https://github.com/rust-lang/libs-team/issues/393.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-08-27std: move allocators to `sys`joboet-21/+3
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-16zkvm: add `#[forbid(unsafe_op_in_unsafe_fn)]` in `stdlib`Erik Kaneda-1/+2
This also adds an additional `unsafe` block to address compiler errors.
2024-06-15std: refactor the TLS implementationjoboet-24/+0
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
2024-05-29Make `std::env::{set_var, remove_var}` unsafe in edition 2024Tobias Bucher-2/+2
Allow calling these functions without `unsafe` blocks in editions up until 2021, but don't trigger the `unused_unsafe` lint for `unsafe` blocks containing these functions. Fixes #27970. Fixes #90308. CC #124866.
2024-05-02std: move thread parking to `sys::sync`joboet-3/+0
2024-04-15zkvm: fix references to `os_str` moduleErik Kaneda-2/+4
The `os_str` module has been moved to `sys`.
2024-04-12zkvm: remove cmathMarijan Petričević-2/+0
- Remove cmath from zkvm module since cmath was moved to sys and is shared by all platforms (see #120109)
2024-04-11Factor some common `io::Error` constantsBenoît du Garreau-4/+1
2024-03-23rename ptr::from_exposed_addr -> ptr::with_exposed_provenanceRalf Jung-2/+2
2024-03-12std: move `Once` implementations to `sys`joboet-2/+0
2024-02-20Delete architecture-specific memchr code in std::sysArthur Carcano-4/+0
Currently all architecture-specific memchr code is only used in `std::io`. Most of the actual `memchr` capacity exposed to the user through the slice API is instead implemented in core::slice::memchr. Hence this commit deletes memchr from std::sys[_common] and replace calls to it by calls to core::slice::memchr functions. This deletes (r)memchr from the list of symbols linked to libc.
2024-02-16std: move locks to `sys` on platforms without threadsjoboet-2/+0
2024-02-08std: move path into `sys`joboet-4/+0
2024-01-22zkvm: add partial std supportErik Kaneda-0/+478
Co-authored-by: Frank Laub <flaub@risc0.com> Co-authored-by: nils <nils@risc0.com> Co-authored-by: Victor Graf <victor@risczero.com> Co-authored-by: weikengchen <w.k@berkeley.edu>