about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2025-04-15Rollup merge of #139836 - glyn:test-mpmc-receiver-cloning, r=jhprattStuart Cook-0/+30
Basic tests of MPMC receiver cloning Ref: https://github.com/rust-lang/rust/issues/126840#issuecomment-2802321146
2025-04-15Rollup merge of #139822 - 0x79de:fix-eopnotsupp-mapping, r=dtolnayStuart Cook-0/+1
Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes #139803
2025-04-15Rollup merge of #139750 - no1wudi:fix, r=tgross35Stuart Cook-6/+11
std/thread: Use default stack size from menuconfig for NuttX * Update comments to clarify the usage of zero as an indication for default stack size configuration * Adjust conditional compilation to reflect the changes in stack size handling for the NuttX platform This change improves clarity and consistency in stack size configuration across platforms.
2025-04-15Rollup merge of #139554 - lolbinarycat:std-output-exit_ok, r=tgross35Stuart Cook-0/+34
std: add Output::exit_ok approved in ACP https://github.com/rust-lang/libs-team/issues/554 Tracking issue: https://github.com/rust-lang/rust/issues/84908
2025-04-15Rollup merge of #139517 - Ayush1325:uefi-cmd-stdin-null, r=joboetStuart Cook-7/+120
std: sys: process: uefi: Use NULL stdin by default According to the docs in `Command::output`: > By default, stdout and stderr are captured (and used to provide the resulting output). Stdin is not inherited from the parent and any attempt by the child process to read from the stdin stream will result in the stream immediately closing. This was being violated by UEFI which was inheriting stdin by default. While the docs don't explicitly state that the default should be NULL, the behaviour seems like reading from NULL. UEFI however, has a bit of a problem. The `EFI_SIMPLE_TEXT_INPUT_PROTOCOL` only provides support for reading 1 key press. This means that you either get an error, or it is assumed that the keypress was read successfully. So there is no way to have a successful read of length 0. Currently, I am returning UNSUPPORTED error when trying to read from NULL stdin. On linux however, you will get a read of length 0 for Null stdin. One possible way to get around this is to translate one of the UEFI errors to a read 0 (Maybe unsupported?). It is also possible to have a non-standard error code, but well, not sure if we go that route. Alternatively, if meaning of Stdio::Null is platform dependent, it should be fine to keep the current behaviour of returning an error. cc ```@nicholasbishop``` ```@dvdhrm```
2025-04-15Basic tests of MPMC receiver cloningGlyn Normington-0/+30
Ref: https://github.com/rust-lang/rust/issues/126840#issuecomment-2802321146
2025-04-14std: add Output::exit_okbinarycat-0/+34
approved in ACP https://github.com/rust-lang/libs-team/issues/554
2025-04-14Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix0x79de-0/+1
This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized. Fixes #139803
2025-04-14Clarify why SGX code specifies linkage/symbol names for certain staticsJethro Beekman-6/+14
Also update the symbol names as items have moved around a bit. The actual name isn't that important, it just needs to be unique. But for debugging it can be useful for it to point to the right place.
2025-04-13Hermit: Unify std::env::args with UnixThalia Archibald-40/+9
The only differences between these implementations are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix.
2025-04-13std: sys: process: uefi: Allow specifying StdinAyush Singh-3/+6
Stdio::MakePipe is not supported. For Stdio::Null, return UNSUPPORTED. This is treated as read(0). Additionally, have infinte loop on the notify function to prevent wait_for_key from returning. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-04-13std: sys: stdio: uefi: Tread UNSUPPORTED Status as read(0)Ayush Singh-2/+6
Allows implementing Stdio::Null for Command in a deterministic manner. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-04-13std: sys: process: uefi: Use NULL stdin by defaultAyush Singh-3/+109
According to the docs in `Command::output`: > By default, stdout and stderr are captured (and used to provide the resulting output). Stdin is not inherited from the parent and any attempt by the child process to read from the stdin stream will result in the stream immediately closing. This was being violated by UEFI which was inheriting stdin by default. While the docs don't explicitly state that the default should be NULL, the behaviour seems like reading from NULL. UEFI however, has a bit of a problem. The `EFI_SIMPLE_TEXT_INPUT_PROTOCOL` only provides support for reading 1 key press. This means that you either get an error, or it is assumed that the keypress was read successfully. So there is no way to have a successful read of length 0. Currently, I am returning UNSUPPORTED error when trying to read from NULL stdin. On linux however, you will get a read of length 0 for Null stdin. One possible way to get around this is to translate one of the UEFI errors to a read 0 (Maybe unsupported?). It is also possible to have a non-standard error code, but well, not sure if we go that route. Alternatively, if meaning of Stdio::Null is platform dependent, it should be fine to keep the current behaviour of returning an error. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-04-13std/thread: Use default stack size from menuconfig for NuttXHuang Qi-6/+11
* Update comments to clarify the usage of zero as an indication for default stack size configuration * Adjust conditional compilation to reflect the changes in stack size handling for the NuttX platform This change improves clarity and consistency in stack size configuration across platforms. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-04-13Rollup merge of #139710 - thaliaarchi:move-args-pal, r=joboetChris Denton-315/+171
Move `args` into `std::sys` Move platform definitions of `args` into `std::sys`, as part of https://github.com/rust-lang/rust/issues/117276. cc ``@joboet``
2025-04-13Rollup merge of #139683 - ChrisDenton:windows-with-native, r=tgross35,joboetChris Denton-47/+86
Use `with_native_path` for Windows Ideally, each platform should use their own native path type internally. This will, for example, allow passing a UTF-16 string directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated wide string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this just does some of the Windows parts. As with the previous Unix PR (#138832) this is intended to be merely a refactoring so I've avoided anything that may require more substantial changes.
2025-04-13Rollup merge of #138972 - thaliaarchi:nuttx-build, r=Mark-SimulacrumChris Denton-0/+3
std: Fix build for NuttX targets Fix std build for all NuttX targets. It is the single largest set of failures on <https://does-it-build.noratrieb.dev/>. Although, ESP-IDF also requires these same gates, there are other issues for those targets. This can verified be running `x check library/std --target=` for all NuttX targets. cc ``@no1wudi``
2025-04-13Auto merge of #139734 - ChrisDenton:rollup-28qn740, r=ChrisDentonbors-125/+125
Rollup of 6 pull requests Successful merges: - #139107 (std: make `cmath` functions safe) - #139607 (Add regression test for #127424) - #139691 (Document that `opt-dist` requires metrics to be enabled) - #139707 (Fix comment in bootstrap) - #139708 (Fix name of field in doc comment) - #139709 (bootstrap: fix typo in doc string) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-13Rollup merge of #139107 - joboet:safe_cmath, r=ibraheemdevChris Denton-125/+125
std: make `cmath` functions safe The floating point intrinsics are more difficult, I'll probably wait until #119899 has merged before making them safe as well.
2025-04-12https://github.com/rust-lang/rust/pull/139717#issuecomment-2799036117 🥴наб-2/+2
2025-04-12Rollup merge of #139688 - rust-lang:notriddle/io-result-unbox, r=GuillaumeGomezChris Denton-0/+2
rustdoc-search: add unbox flag to Result aliases Fixes #139665
2025-04-12Rollup merge of #139382 - ChrisDenton:windows-bindgen-0-61, r=Mark-SimulacrumChris Denton-28/+285
Update windows-bindgen to 0.61.0 This updates the automatically generate Windows API bindings. Not much changed this time: - There's now `Default` implementations for many types, which is convenient. It does however conflict with one place where we implemented a non-zeroed default (to set the length field). But that's no big problem. - The `--no-core` flag has been renamed to `--no-deps` to more accurately reflect its meaning (i.e. generate all necessary code without requiring additional dependencies). - The `--link` flag allows us to set the location of the `link!` macro. Currently we use our workspace's `windows_targets` crate but we could move it into library/std using `--link`. However, this would need to be co-ordinated with the `backtrace` crate (which is a separate crate but included in std using `#[path]`). So I've left that for another time.
2025-04-12Rollup merge of #139276 - tgross35:enable-f16-without-neon, r=Mark-SimulacrumChris Denton-7/+0
Revert "Disable `f16` on Aarch64 without `neon`" The LLVM issue [1] was resolved and the fix was synced to rust-lang/rust in [2]. This reverts commit c51b229140c885cac757a405a328a07e90d5bca9. [1]: https://github.com/llvm/llvm-project/issues/129394 [2]: https://github.com/rust-lang/rust/pull/138695 try-job: aarch64-gnu try-job: aarch64-gnu-debug try-job: armhf-gnu try-job: dist-various-1
2025-04-12Unify owned Args types between platformsThalia Archibald-222/+77
2025-04-12Use unsupported args for espidf and vitaThalia Archibald-14/+3
2025-04-12Move args into std::sysThalia Archibald-41/+53
2025-04-11rustdoc-search: add unbox flag to Result aliasesMichael Howell-0/+2
Fixes #139665
2025-04-11Use with_native_path for WindowsChris Denton-47/+86
Also add a WCStr type
2025-04-11sync::mpsc: prevent double free on `Drop`Petros Angelatos-1/+7
This PR is fixing a regression introduced by #121646 that can lead to a double free when dropping the channel. The details of the bug can be found in the corresponding crossbeam PR https://github.com/crossbeam-rs/crossbeam/pull/1187 Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2025-04-11sync::mpsc: add miri reproducer of double freePetros Angelatos-0/+5
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2025-04-11cfi: Remove #[no_sanitize(cfi)] for extern weak functionsBastian Kersting-40/+0
Previously (https://github.com/rust-lang/rust/pull/115200, https://github.com/rust-lang/rust/pull/138002), we added `#[no_sanitize(cfi)]` to all code paths that call to a weakly linked function. In https://github.com/rust-lang/rust/pull/138349 we fixed the root cause for this issue, which means we can now remove the corresponding attributes.
2025-04-11Rollup merge of #139600 - tgross35:update-builtins, r=tgross35Stuart Cook-1/+1
Update `compiler-builtins` to 0.1.153 Includes the following changes: * Avoid OOB access in `memcpy` and `memmove` [1] * Enable intrinsics on AVR [2] * `libm` updates to avoid using `core::arch` vector intrinsics [3] * Re-enable `f16` on aarch64 without Neon [4] [1]: https://github.com/rust-lang/compiler-builtins/pull/799 [2]: https://github.com/rust-lang/compiler-builtins/pull/791 [3]: https://github.com/rust-lang/compiler-builtins/pull/814 [4]: https://github.com/rust-lang/compiler-builtins/pull/809
2025-04-10Update `compiler-builtins` to 0.1.153Trevor Gross-1/+1
Includes the following changes: * Avoid OOB access in `memcpy` and `memmove` [1] * Enable intrinsics on AVR [2] * `libm` updates to avoid using `core::arch` vector intrinsics [3] * Re-enable `f16` on aarch64 without Neon [4] [1]: https://github.com/rust-lang/compiler-builtins/pull/799 [2]: https://github.com/rust-lang/compiler-builtins/pull/791 [3]: https://github.com/rust-lang/compiler-builtins/pull/814 [4]: https://github.com/rust-lang/compiler-builtins/pull/809
2025-04-10Use posix_spawn on cygwinBerrysoft-2/+6
2025-04-10Doc more control flow behaviour for return keywordLynnesbian-0/+22
2025-04-10Document async block control flow in async keywordLynnesbian-0/+38
2025-04-10Auto merge of #139279 - BoxyUwU:bump-boostrap, r=jieyouxubors-57/+56
Bump boostrap compiler to new beta try-job: `*msvc*`
2025-04-09Rollup merge of #139164 - xizheyin:issue-139034, r=joboetMatthias Krüger-2/+8
std: improve documentation for get_mut() methods regarding forgotten guards Fixes #139034 This PR improves the documentation for `get_mut()` methods in `Mutex`, `RefCell`, and `RwLock` to clarify their behavior when lock guards are forgotten (e.g., via std::mem::forget). The current documentation for these methods states that a mutable borrow "statically guarantees no locks exist", which is not entirely accurate. While a mutable borrow prevents new locks from being created, it does not clear or detect previously abandoned locks through `forget()`. This can lead to counterintuitive behavior: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=e68cefec12dcd435daf2237c16824ed3 https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=81263ad652c752afd63c903113d3082c https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=311baa4edb3abf82a25c8d7bf21a4a52 r? libs
2025-04-09Rollup merge of #138869 - ChrisDenton:command-curdir, r=tgross35Matthias Krüger-4/+83
Try not to use verbatim paths in `Command::current_dir` If possible, we should try not to use verbatim paths in `Command::current_dir`. It might work but it might also break code in the subprocess that assume the current directory isn't verbatim (including Windows APIs). cc ``@ehuss`` Side note: we now have a lot of ad-hoc fixes like this spread about the place. It'd be good to make a proper `WindowsPath` type that handles all this in one place. But that's a bigger job for another PR.
2025-04-09update cfgsBoxy-5/+4
2025-04-09replace version placeholderBoxy-52/+52
2025-04-09Avoid verbatim paths in Command::current_dirChris Denton-4/+83
If possible, we should try not to use verbatim paths in Command::current_dir. It might work but it might also break code (including some Windows APIs) that assume the current directory isn't verbatim.
2025-04-08clarify std::fs::set_permissions symlink behaviorbinarycat-6/+8
nest under platform-specific behavior, factor rationale into its own section, and tweak language.
2025-04-08std(docs): clarify how std::fs::set_permisions works with symlinksbinarycat-0/+13
fixes https://github.com/rust-lang/rust/issues/75942 fixes https://github.com/rust-lang/rust/issues/124201
2025-04-06Rollup merge of #138876 - thaliaarchi:trusty-stdio, r=NoratriebGuillaume Gomez-38/+49
Trusty: Implement `write_vectored` for stdio Currently, `write` for stdout and stderr on Trusty is implemented with the semantics of `write_all`. Instead, call the underlying syscall only once in `write` and use the default implementation of `write_all` like other platforms. Also, implement `write_vectored` by adding support for `IoSlice`. Refactor stdin to reuse the unsupported type like https://github.com/rust-lang/rust/pull/136769. It requires #138875 to fix the build for Trusty, though they do not conflict and can merge in either order. cc `@randomPoison`
2025-04-05std: Fix build for NuttX targetsThalia Archibald-0/+3
Fix std build for all NuttX targets. It is the single largest set of failures on <https://does-it-build.noratrieb.dev/>. Although, ESP-IDF also requires these same gates, there are other issues for those targets. This can verified be running `x check library/std --target=` for all NuttX targets.
2025-04-05Rollup merge of #139121 - thaliaarchi:rename-thread_local-statik, r=NoratriebMatthias Krüger-3/+3
Rename internal module from `statik` to `no_threads` This module is named in reference to the keyword, but the term is somewhat overloaded. Rename it to more clearly describe it and avoid the misspelling.
2025-04-05Rollup merge of #139092 - thaliaarchi:move-fd-pal, r=joboetMatthias Krüger-31/+53
Move `fd` into `std::sys` Move platform definitions of `fd` into `std::sys`, as part of https://github.com/rust-lang/rust/issues/117276. Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms. Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too. cc `@joboet,` `@ChrisDenton` try-job: x86_64-gnu-aux
2025-04-04Rename internal module from statik to no_threadsThalia Archibald-3/+3
This module is named in reference to the keyword, but the term is somewhat overloaded. Rename it to more clearly describe it and avoid the misspelling.
2025-04-05std: Add performance warnings to HashMap::get_disjoint_mutxizheyin-0/+3
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>