about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2025-02-06Rollup merge of #136152 - Urgau:stabilize-map_many_mut, r=joshtriplettMatthias Krüger-15/+17
Stabilize `map_many_mut` feature This PR stabilize `HashMap::get_many_mut` as `HashMap::get_disjoint_mut` and `HashMap::get_many_unchecked_mut` as `HashMap::get_disjoint_unchecked_mut` per FCP. FCP at https://github.com/rust-lang/rust/issues/97601#issuecomment-2532710423 Fixes #97601 r? libs
2025-02-06tests(std): don't output to std{out,err} in `test_creation_flags` and ↵许杰友 Jieyou Xu (Joe)-3/+12
`test_proc_thread_attributes`
2025-02-05Rollup merge of #136449 - joboet:move_pal_net, r=ChrisDenton许杰友 Jieyou Xu (Joe)-1036/+113
std: move network code into `sys` 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.
2025-02-05Rollup merge of #136418 - Ayush1325:command-env, r=jhpratt许杰友 Jieyou Xu (Joe)-3/+62
uefi: process: Add support for command environment variables Set environment variables before launching the process and restore the prior variables after the program exists. This is the same implementation as the one used by UEFI Shell Execute [0]. [0]: https://github.com/tianocore/edk2/blob/2d2642f4832ebc45cb7d5ba9430b933d953b94f2/ShellPkg/Application/Shell/ShellProtocol.c#L1700
2025-02-04Auto merge of #136534 - jhpratt:rollup-dnz57dq, r=jhprattbors-8/+6
Rollup of 6 pull requests Successful merges: - #136398 (add UnsafeCell direct access APIs) - #136465 (Some `rustc_middle` cleanups) - #136479 (std::fs: further simplify dirent64 handling) - #136504 (Fix last compare-mode false negatives in tests) - #136511 (Add `cast_signed` and `cast_unsigned` methods for `NonZero` types) - #136518 (Add note about `FnPtr` trait being exposed as public bound) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-04Rollup merge of #136479 - RalfJung:dirent64, r=tgross35Jacob Pratt-8/+6
std::fs: further simplify dirent64 handling Follow-up to https://github.com/rust-lang/rust/pull/134678. r? `@tgross35`
2025-02-04Rollup merge of #136167 - pitaj:new_range, r=NadrierilJacob Pratt-0/+2
Implement unstable `new_range` feature Switches `a..b`, `a..`, and `a..=b` to resolve to the new range types. For rust-lang/rfcs#3550 Tracking issue #123741 also adds the re-export that was missed in the original implementation of `new_range_api`
2025-02-04Rollup merge of #135621 - bjorn3:move_tests_to_stdtests, r=NoratriebJacob Pratt-11586/+8
Move some std tests to integration tests Unit tests directly inside of standard library crates require a very fragile way of building that is hard to reproduce outside of bootstrap. Follow up to https://github.com/rust-lang/rust/pull/133859
2025-02-03Rollup merge of #136289 - Pyr0de:oncecell-docs, r=tgross35Matthias Krüger-29/+36
OnceCell & OnceLock docs: Using (un)initialized consistently Changed * `set` / `initialize` / `full` to `initialized state` * `uninitialize` / `empty` to `uninitialized state` * `f` to `f()` * Added explaination of `uninitialized state` & `initialized state` [OnceCell Docs](https://doc.rust-lang.org/nightly/std/cell/struct.OnceCell.html) [OnceLock Docs](https://doc.rust-lang.org/nightly/std/sync/struct.OnceLock.html) Fixes #85716 ``@rustbot`` label +A-docs
2025-02-03OnceCell & OnceLock docs: Using (un)initialized consistentlyPyrode-29/+36
2025-02-03std::fs: further simplify dirent64 handlingRalf Jung-8/+6
2025-02-02std: move network code into `sys`joboet-1036/+113
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.
2025-02-02Rollup merge of #134272 - RalfJung:destabilize-rustc_encodable_decodable, ↵Matthias Krüger-10/+0
r=oli-obk Remove rustc_encodable_decodable feature This has been shown in future-compat reports since Rust 1.79 (https://github.com/rust-lang/rust/pull/116016), released June 2024. Let's see if crater still finds any issues. Part of https://github.com/rust-lang/rust/issues/134301. Cc ``@rust-lang/libs-api``
2025-02-02Rollup merge of #136133 - hkBst:patch-23, r=ibraheemdevMatthias Krüger-8/+4
Fix sentence in process::abort
2025-02-02uefi: process: Add support for command environment variablesAyush Singh-3/+62
Set environment variables before launching the process and restore the prior variables after the program exists. This is the same implementation as the one used by UEFI Shell Execute [0]. [0]: https://github.com/tianocore/edk2/blob/2d2642f4832ebc45cb7d5ba9430b933d953b94f2/ShellPkg/Application/Shell/ShellProtocol.c#L1700 Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-02-01Rollup merge of #136360 - slanterns:once_wait, r=tgross35Matthias Krüger-7/+3
Stabilize `once_wait` Closes: https://github.com/rust-lang/rust/issues/127527. `@rustbot` label: +T-libs-api r? libs-api
2025-02-01Rollup merge of #135684 - ranger-ross:mutex-docs, r=joboetMatthias Krüger-2/+30
docs: Documented Send and Sync requirements for Mutex + MutexGuard This an attempt to continue where #123225 left off. I did some light clean up from the work done in that PR. I also documented the `!Send` + `Sync` implementations for `MutexGuard` to the best of my knowledge. Let me know if I got anything wrong :smile: fixes #122856 cc: ``@IoaNNUwU`` r? ``@joboet``
2025-02-01Fix sentence in process::abortMarijn Schouten-8/+4
2025-02-01docs: Documented Send and Sync requirements for Mutex + MutexGuardRoss Sullivan-2/+30
2025-02-01stabilize `once_wait`Slanterns-7/+3
2025-01-30std::rangePeter Jaszkowiak-0/+2
2025-01-30Rollup merge of #136288 - ↵Matthias Krüger-17/+40
joshtriplett:would-you-could-you-with-some-locks--would-you-could-you-in-some-docs, r=m-ou-se Improve documentation for file locking Add notes to each method stating that locks get dropped on close. Clarify the return values of the try methods: they're only defined if the lock is held via a *different* file handle/descriptor. That goes along with the documentation that calling them while holding a lock via the *same* file handle/descriptor may deadlock. Document the behavior of unlock if no lock is held. r? `@m-ou-se` (Documentation changes requested in https://github.com/rust-lang/rust/issues/130994 .)
2025-01-30Rollup merge of #135475 - Ayush1325:uefi-absolute-path, r=jhprattMatthias Krüger-5/+158
uefi: Implement path This PR is split off from https://github.com/rust-lang/rust/pull/135368 to reduce noise. UEFI paths can be of 4 types: 1. Absolute Shell Path: Uses shell mappings 2. Absolute Device Path: this is what we want 3. Relative root: path relative to the current root. 4. Relative Absolute shell path can be identified with `:` and Absolute Device path can be identified with `/`. Relative root path will start with `\`. The algorithm is mostly taken from edk2 UEFI shell implementation and is somewhat simple. Check for the path type in order. For Absolute Shell path, use `EFI_SHELL->GetDevicePathFromMap` to get a BorrowedDevicePath for the volume. For Relative paths, we use the current working directory to construct the new path. BorrowedDevicePath abstraction is needed to interact with `EFI_SHELL->GetDevicePathFromMap` which returns a Device Path Protocol with the lifetime of UEFI shell. Absolute Shell paths cannot exist if UEFI shell is missing. cc `@nicholasbishop`
2025-01-30Improve documentation for file lockingJosh Triplett-17/+40
Add notes to each method stating that locks get dropped on close. Clarify the return values of the try methods: they're only defined if the lock is held via a *different* file handle/descriptor. That goes along with the documentation that calling them while holding a lock via the *same* file handle/descriptor may deadlock. Document the behavior of unlock if no lock is held.
2025-01-29Auto merge of #136248 - matthiaskrgr:rollup-leaxgfd, r=matthiaskrgrbors-1/+1
Rollup of 8 pull requests Successful merges: - #133382 (Suggest considering casting fn item as fn pointer in more cases) - #136092 (Test pipes also when not running on Windows and Linux simultaneously) - #136190 (Remove duplicated code in RISC-V asm bad-reg test) - #136192 (ci: remove unused windows runner) - #136205 (Properly check that array length is valid type during built-in unsizing in index) - #136211 (Update mdbook to 0.4.44) - #136212 (Tweak `&mut self` suggestion span) - #136214 (Make crate AST mutation accessible for driver callback) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-29Rollup merge of #136092 - tbu-:pr_io_pipe_test, r=joboetMatthias Krüger-1/+1
Test pipes also when not running on Windows and Linux simultaneously Fixes https://github.com/rust-lang/rust/pull/135635#pullrequestreview-2574184488. Based on top of #135635 to avoid merge conflicts.
2025-01-29Rollup merge of #136186 - Ayush1325:uefi-process-args-fix, ↵León Orell Valerian Liehr-4/+3
r=nicholasbishop,Noratrieb uefi: process: Fix args - While working on process env support, I found that args were currently broken. Not sure how I missed it in the PR, but well here is the fix. - Additionally, no point in adding space at the end of args.
2025-01-28uefi: process: Fix argsAyush Singh-4/+3
- While working on process env support, I found that args were currently broken. Not sure how I missed it in the PR, but well here is the fix. - Additionally, no point in adding space at the end of args. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-01-28Rollup merge of #136012 - hkBst:patch-22, r=workingjubilee,tgross35Matthias Krüger-6/+44
Document powf and powi values that are always 1.0 fixes bug #90429
2025-01-28Document powf and powi calls that always return 1.0Marijn Schouten-6/+44
2025-01-27Stabilize `HashMap::get_many_mut` as `HashMap::get_disjoint_mut`Urgau-15/+17
as well as `HashMap::get_many_unchecked_mut` to `HashMap::get_disjoint_unchecked_mut`.
2025-01-27Rollup merge of #135876 - usamoi:mpmc-doc, r=tgross35Guillaume Gomez-4/+12
fix doc for std::sync::mpmc fix document of `std::sync::mpmc` (tracked in https://github.com/rust-lang/rust/issues/126840)
2025-01-27fix doc for std::sync::mpmcusamoi-4/+12
2025-01-27Rollup merge of #135635 - tbu-:pr_io_pipe, r=joboetLeón Orell Valerian Liehr-272/+281
Move `std::io::pipe` code into its own file Also update the docs for the new location, create a section "Platform-specific behavior", don't hide required imports for code examples.
2025-01-26Auto merge of #136087 - jhpratt:rollup-tam1mzn, r=jhprattbors-10/+3
Rollup of 7 pull requests Successful merges: - #133631 (Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only)) - #134358 (compiler: Set `target_abi = "ilp32e"` on all riscv32e targets) - #135812 (Fix GDB `OsString` provider on Windows ) - #135842 (TRPL: more backward-compatible Edition changes) - #135946 (Remove extra whitespace from rustdoc breadcrumbs for copypasting) - #135953 (ci.py: check the return code in `run-local`) - #136019 (Add an `unchecked_div` alias to the `Div<NonZero<_>>` impls) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-26Test pipes also when not running on Windows and Linux simultaneouslyTobias Bucher-1/+1
Fixes https://github.com/rust-lang/rust/pull/135635#pullrequestreview-2574184488.
2025-01-26Update `std::io::{pipe, PipeReader, PipeWriter}` docs the new locationTobias Bucher-16/+20
Also create a section "Platform-specific behavior", don't hide required imports for code examples.
2025-01-26Move `std::io::pipe` code into its own fileTobias Bucher-272/+277
2025-01-26Move std::sync unit tests to integration testsbjorn3-4130/+8
This removes two minor OnceLock tests which test private methods. The rest of the tests should be more than enough to catch mistakes in those private methods. Also makes ReentrantLock::try_lock public. And finally it makes the mpmc tests actually run.
2025-01-26Move std::thread_local unit tests to integration testsbjorn3-422/+0
2025-01-26Move std::time unit tests to integration testsbjorn3-277/+0
2025-01-26Move std::path unit tests to integration testsbjorn3-2082/+0
2025-01-26Move std::panic unit tests to integration testsbjorn3-59/+0
2025-01-26Move std::num unit tests to integration testsbjorn3-233/+0
2025-01-26Move std float unit tests to integration testsbjorn3-3813/+0
2025-01-26Move std::error unit tests to integration testsbjorn3-447/+0
2025-01-26Move std::env unit tests to integration testsbjorn3-123/+0
2025-01-26Rollup merge of #133631 - flba-eb:add_nto_qnx71_iosock_support, r=workingjubileeJacob Pratt-10/+3
Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only) Changes of this pull request: 1. Refactor code for qnx nto targets to share more code in file `nto_qnx.rs` 1. Add support for an additional network stack on nto qnx 7.1. QNX 7.1 supports two network stacks: 1. `io-pkt`, which is default 2. `io-sock`, which is optional on 7.1 but default in QNX 8.0 As one can see in the [io-sock migration notes](https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html), this changes the libc API in a way similar to e.g. linux-gnu vs. linux-musl. This change adds a new target which has a different value for `target_env`, so that e.g. libc can distinguish between both APIs. 2. Add initial support for QNX 8.0, thanks to AkhilTThomas. As it turned out, the problem with forking many processes still exists in QNX 8.0. Because if this, we are now using it for any QNX version (i.e. not check for `target_env` anymore).
2025-01-25Rollup merge of #135948 - bjorn3:update_emscripten_std_tests, r=Mark-SimulacrumJacob Pratt-10/+5
Update emscripten std tests This disables a bunch of emscripten tests that test things emscripten doesn't support and re-enables a whole bunch of tests which now work just fine on emscripten. Tested with `EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" ./x.py test library/ --target wasm32-unknown-emscripten`.
2025-01-25Improve and expand documentation of pipesJosh Triplett-8/+14
- Simplify some of the language - Minor grammar fixes - Don't imply that pipes *only* work across multiple processes; instead, *suggest* that they're typically used across two or more separate processes. - Specify that portable applications cannot use multiple readers or multiple writers for messages larger than a byte, due to potential interleaving. - Remove no-longer-referenced footnote URLs.