about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2025-07-02Rollup merge of #141847 - xizheyin:141837, r=jhprattMatthias Krüger-15/+41
Explain `TOCTOU` on the top of `std::fs`, and reference it in functions Fixes rust-lang/rust#141837 r? ``````@workingjubilee``````
2025-07-02Auto merge of #142974 - cuviper:stage0-bump, r=Mark-Simulacrumbors-22/+22
Update stage0 to 1.89.0-beta.1 - Update version placeholders - Update stage0 to 1.89.0-beta.1 - Update `STAGE0_MISSING_TARGETS` - Update `cfg(bootstrap)` r? `@Mark-Simulacrum` try-job: dist-i586-gnu-i586-i686-musl
2025-07-01Update version placeholdersJosh Stone-22/+22
2025-07-01Rollup merge of #142760 - epage:lock, r=tgross35Guillaume Gomez-6/+6
docs(fs): Touch up grammar on lock api
2025-07-01Upgrade the `fortanix-sgx-abi` dependencyTrevor Gross-1/+1
0.6.1 removes the `compiler-builtins` dependency, part of RUST-142265. The breaking change from 0.5 to 0.6 is for an update to the `insecure_time` API [1]. I validated that `./x c library --target x86_64-fortanix-unknown-sgx` completes successfully with this change. Link: https://github.com/fortanix/rust-sgx/commit/a34e9767f37d6585c18bdbd31cddcadc56670d57 [1]
2025-06-30Rollup merge of #143090 - ChrisDenton:workaround1, r=tgross35dianqk-21/+91
Workaround for memory unsafety in third party DLLs Resolves rust-lang/rust#143078 Note that we can't make any guarantees if third parties intercept OS functions and don't implement them according to the documentation. However, I think it's practical to attempt mitigations when issues are encountered in the wild and the mitigation itself isn't too invasive.
2025-06-29Rollup merge of #142889 - nabijaczleweli:rusts, r=Mark-SimulacrumMatthias Krüger-7/+5
Clarify doc comment on unix OpenOptions
2025-06-28Rollup merge of #143082 - fee1-dead-contrib:push-qvvppzukvkxt, r=Mark-SimulacrumMatthias Krüger-4/+4
update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang/rust#141990 so update here; signaling -> sending signals to because the latter reads better to me.
2025-06-28Rollup merge of #123476 - devnexen:std_net_solaris_exclbind, r=Mark-SimulacrumMatthias Krüger-0/+117
std::net: adding `unix_socket_exclbind` feature for solaris/illumos. allows to have a tigher control over the binding exclusivness of the socket. ACP: https://github.com/rust-lang/libs-team/issues/366
2025-06-28"set by Rusts options". Remove misleading always-true if cfg!(unix). Drop ↵наб-7/+5
#![feature(rustc_private)]
2025-06-28Workaround for mem safety in third party dllsChris Denton-21/+91
2025-06-27Update poison.rs to fix the typo (sys->sync)Kurt Heiritz (pseudo)-1/+1
2025-06-27update internal `send_signal` commentDeadbeef-4/+4
2025-06-27Auto merge of #143074 - compiler-errors:rollup-cv64hdh, r=compiler-errorsbors-1/+1
Rollup of 18 pull requests Successful merges: - rust-lang/rust#137843 (make RefCell unstably const) - rust-lang/rust#140942 (const-eval: allow constants to refer to mutable/external memory, but reject such constants as patterns) - rust-lang/rust#142549 (small iter.intersperse.fold() optimization) - rust-lang/rust#142637 (Remove some glob imports from the type system) - rust-lang/rust#142647 ([perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation) - rust-lang/rust#142700 (Remove incorrect comments in `Weak`) - rust-lang/rust#142927 (Add note to `find_const_ty_from_env`) - rust-lang/rust#142967 (Fix RwLock::try_write documentation for WouldBlock condition) - rust-lang/rust#142986 (Port `#[export_name]` to the new attribute parsing infrastructure) - rust-lang/rust#143001 (Rename run always ) - rust-lang/rust#143010 (Update `browser-ui-test` version to `0.20.7`) - rust-lang/rust#143015 (Add `sym::macro_pin` diagnostic item for `core::pin::pin!()`) - rust-lang/rust#143033 (Expand const-stabilized API links in relnotes) - rust-lang/rust#143041 (Remove cache for citool) - rust-lang/rust#143056 (Move an ACE test out of the GCI directory) - rust-lang/rust#143059 (Fix 1.88 relnotes) - rust-lang/rust#143067 (Tracking issue number for `iter_macro`) - rust-lang/rust#143073 (Fix some fixmes that were waiting for let chains) Failed merges: - rust-lang/rust#143020 (codegen_fn_attrs: make comment more precise) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-26Rollup merge of #142967 - krikera:fix-rwlock-try-write-docs, r=jhprattMichael Goulet-1/+1
Fix RwLock::try_write documentation for WouldBlock condition Fix RwLock::try_write documentation for WouldBlock condition The documentation incorrectly stated that try_write only fails when 'already locked exclusively', but it actually fails when there are either shared (read) or exclusive (write) locks. Fixes rust-lang/rust#142852
2025-06-26Fix RwLock::try_write documentation for WouldBlock conditionkrikera-1/+1
2025-06-25make `tidy-alphabetical` use a natural sortFolkert de Vries-5/+5
2025-06-24Rollup merge of #142453 - ChrisDenton:fused, r=AmanieuJubilee-0/+1
Windows: make `read_dir` stop iterating after the first error is encountered This also essentially makes the `ReadDir` iterator fused. Which I think is pretty much what people expect anyway. [`FindNextFileW`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextfilew) doesn't document what happens if you call it after iteration ends or after an error so we're probably in implementation defined territory at that point.
2025-06-24Rollup merge of #142704 - tgross35:remove-concat_idents, r=fee1-deadGuillaume Gomez-6/+3
Remove the deprecated unstable `concat_idents!` macro In [rust-lang/rust#137653], the lang and libs-API teams did a joint FCP to deprecate and eventually remove the long-unstable `concat_idents!` macro. The deprecation is landing in 1.88, so do the removal here (target version 1.90). This macro has been superseded by the more recent `${concat(...)}` metavariable expression language feature, which avoids some of the limitations of `concat_idents!`. The metavar expression is unstably available under the [`macro_metavar_expr_concat`] feature. History is mildly interesting here: `concat_idents!` goes back to 2011 when it was introduced with 513276e595f8 ("Add #concat_idents[] and #ident_to_str[]"). The syntax looks a bit different but it still works about the same: let asdf_fdsa = "<.<"; assert(#concat_idents[asd,f_f,dsa] == "<.<"); assert(#ident_to_str[use_mention_distinction] == "use_mention_distinction"); (That test existed from introduction until its removal here.) Closes: https://github.com/rust-lang/rust/issues/29599 [rust-lang/rust#137653]: https://github.com/rust-lang/rust/pull/137653 [`macro_metavar_expr_concat`]: https://github.com/rust-lang/rust/issues/124225
2025-06-24Remove the deprecated `concat_idents!` macroTrevor Gross-6/+3
In [137653], the lang and libs-API teams did a joint FCP to deprecate and eventually remove the long-unstable `concat_idents!` macro. The deprecation is landing in 1.88, so do the removal here (target version 1.90). This macro has been superseded by the more recent `${concat(...)}` metavariable expression language feature, which avoids some of the limitations of `concat_idents!`. The metavar expression is unstably available under the [`macro_metavar_expr_concat`] feature. History is mildly interesting here: `concat_idents!` goes back to 2011 when it was introduced with 513276e595f8 ("Add #concat_idents[] and about the same: let asdf_fdsa = "<.<"; assert(#concat_idents[asd,f_f,dsa] == "<.<"); assert(#ident_to_str[use_mention_distinction] == "use_mention_distinction"); (That test existed from introduction until its removal here.) Closes: https://www.github.com/rust-lang/rust/issues/29599 [137653]: https://www.github.com/rust-lang/rust/pull/137653 [`macro_metavar_expr_concat`]: https://www.github.com/rust-lang/rust/issues/124225
2025-06-24Rollup merge of #140005 - mlowicki:patch-1, r=tgross35Guillaume Gomez-1/+36
Set MSG_NOSIGNAL for UnixStream https://github.com/rust-lang/rust/issues/139956 Same logic as for https://github.com/rust-lang/rust/blob/1f76d219c906f0112bb1872f33aa977164c53fa6/library/std/src/sys/net/connection/socket.rs#L399-L405.
2025-06-23Rollup merge of #141324 - Ayush1325:uefi-rand-fallback, r=joboetJubilee-19/+150
std: sys: random: uefi: Provide rdrand based fallback Some UEFI systems based on American Megatrends Inc. v3.3 do not provide RNG support [1]. So fallback to rdrand in such cases. [1]: https://github.com/rust-lang/rust/issues/138252#issuecomment-2891270323 Fixes https://github.com/rust-lang/rust/issues/138252 cc `@seijikun`
2025-06-22Stop dbg! macro yapping about format modifiersmejrs-1/+8
2025-06-20Add diagnostic items for ClippySamuel Tardieu-0/+2
2025-06-20Rollup merge of #141990 - Qelxiros:141975-unix_send_signal, ↵Trevor Gross-8/+67
r=ChrisDenton,tgross35 Implement send_signal for unix child processes Tracking issue: rust-lang/rust#141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`. try-job: `dist-various*` try-job: `test-various*`
2025-06-19docs(fs): Touch up grammar on lock apiEd Page-6/+6
2025-06-19wasm: rm static mutMarijn Schouten-7/+10
2025-06-19Auto merge of #141864 - Berrysoft:cygwin-path, r=ChrisDentonbors-173/+300
Handle win32 separator for cygwin paths This PR handles a issue that cygwin actually supports Win32 path, so we need to handle the Win32 prefix and separaters. r? `@mati865` cc `@jeremyd2019` ~~Not sure if I should handle the prefix like the windows target... Cygwin *does* support win32 paths directly going through the APIs, but I think it's not the recommended way.~~ Here I just use `cygwin_conv_path` because it handles both cygwin and win32 paths correctly and convert them into absolute POSIX paths. UPDATE: Windows path prefix is handled.
2025-06-18add ChildExt(::send_signal)Jeremy Smart-8/+67
2025-06-17Rollup merge of #142517 - ChrisDenton:anon-pipe, r=Mark-SimulacrumJacob Pratt-86/+142
Windows: Use anonymous pipes in Command When setting `Stdio::pipe` on `Command` we want to create an anonymous pipe that can be used asynchronously (at least on our end). Usually we'd use [`CreatePipe`](https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe) to open anonymous pipes but unfortunately it opens pipes for synchronous access. The alternative is to use [`CreateNamedPipeW`](https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createnamedpipew) which does allow asynchronous access but that requires giving a file name to the pipe. So we currently have this awful hack where we attempt to emulate anonymous pipes using `CreateNamedPipeW` by attempting to create a unique name and looping until we find one that doesn't already exist. The better option is to use the lower level [`NtCreateNamedPipeFile`](https://learn.microsoft.com/en-us/windows/win32/devnotes/nt-create-named-pipe-file) (which is used internally by both `CreatePipe` and `CreateNamedPipeW`). This function wasn't documented until a few years ago but now that it is it's ok for us to use it. try-job: *msvc* try-job: *mingw*
2025-06-16Rollup merge of #142236 - yotamofek:pr/std/pathbuf-extend-docs, r=tgross35Jakub Beránek-0/+27
Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls I think it's not very obvious that `PathBuf`'s `Extend` and `FromIterator` impls work like `PathBuf::push`, so I think these should be documented. I'm not very happy with the wording and examples, open to suggestions :)
2025-06-16Add documentation for `PathBuf`'s `FromIterator` and `Extend` implsYotam Ofek-0/+27
2025-06-16Set MSG_NOSIGNAL for UnixSteamMichał Łowicki-1/+36
https://github.com/rust-lang/rust/issues/139956 fix
2025-06-16Handle win32 separator & prefixes for cygwin paths王宇逸-173/+300
2025-06-15Windows: Use anonymous pipes in CommandChris Denton-86/+142
2025-06-15Stabilize "file_lock" featureChristopher Berner-15/+10
2025-06-14Rollup merge of #141493 - tamird:addreskind-bytestr, r=joshtriplettMatthias Krüger-4/+14
Delegate `<SocketAddr as Debug>` to `ByteStr` This allows UTF-8 characters to be printed without escapes, rather than just ASCII. r? ``@joshtriplett``
2025-06-13Windows: make read_dir stop iterating on errorChris Denton-0/+1
2025-06-13Remove "intermittent" wording from `ReadDir`Chris Denton-3/+2
2025-06-12Delegate `<SocketAddr as Debug>` to `ByteStr`Tamir Duberstein-4/+14
This allows UTF-8 characters to be printed without escapes, rather than just ASCII.
2025-06-10std::net: adding `unix_socket_exclbind` feature for solaris/illumos.David Carlier-0/+117
allows to have a tigher control over the binding exclusivness of the socket.
2025-06-10Rollup merge of #142102 - kiseitai3:141714_stdin_read_to_string_docs, r=tgross35León Orell Valerian Liehr-0/+40
docs: Small clarification on the usage of read_to_string and read_to_end trait methods Small clarification on the usage of read_to_string and read_to_end trait methods. The goal is to make it clear that these trait methods will become locked up if attempting to read to the end of stdin (which is a bit non-sensical unless the other end closes the pipe). Fixes: rust-lang/rust#141714
2025-06-10docs: Small clarification on the usage of read_to_string and read_to_end ↵kiseitai3-0/+40
trait methods
2025-06-09Auto merge of #138062 - LorrensP-2158466:miri-enable-float-nondet, r=RalfJungbors-20/+20
Enable Non-determinism of float operations in Miri and change std tests Links to [#4208](https://github.com/rust-lang/miri/issues/4208) and [#3555](https://github.com/rust-lang/miri/issues/3555) in Miri. Non-determinism of floating point operations was disabled in rust-lang/rust#137594 because it breaks the tests and doc-tests in core/coretests and std. This PR enables some of them. This pr includes the following changes: - Enables the float non-determinism but with a lower relative error of 4ULP instead of 16ULP - These operations now have a fixed output based on the C23 standard, except the pow operations, this is tracked in [#4286](https://github.com/rust-lang/miri/issues/4286#issue-3010677983) - Changes tests that made incorrect assumptions about the operations, not to make that assumption anymore (from `assert_eq!` to `assert_approx_eq!`. - Changed the doctests of the stdlib of these operations to compare against fixed constants instead of `f*::EPSILON`, which now succeed with Miri and `-Zmiri-many-seeds` - Added a constant `APPROX_DELTA` in `std/tests/floats/f32.rs` which is used for approximation tests, but with a different value when run in Miri. This is to make these tests succeed. - Added tests in the float tests of Miri to test the C23 behaviour. Fixes https://github.com/rust-lang/miri/issues/4208
2025-06-09Rollup merge of #142238 - RalfJung:nonnull_provenance, r=workingjubileeTrevor Gross-1/+0
stabilize nonnull_provenance Fixes https://github.com/rust-lang/rust/issues/135243 FCP passed in https://github.com/rust-lang/rust/issues/135243
2025-06-09Rollup merge of #142192 - Urgau:dedup-f16-f128-test-attrs, r=tgross35Matthias Krüger-134/+2
De-duplicate f16 & f128 doctest attributes Now that rustdoc supports `#[doc(test(attr(...)))]` at every level, thanks to https://github.com/rust-lang/rust/pull/140560, we can de-duplicate the f16 & f128 doctest attributes. Unfortunately we can de-duplicate the `cfg`s attribute as rustdoc would complain about missing `main`, but it's already much better than before. Addresses https://github.com/rust-lang/rust/pull/140323/files#r2062702761 r? `@tgross35`
2025-06-09Rollup merge of #129121 - devnexen:stabilize_ext_linux_tcp_layer, r=tgross35Matthias Krüger-10/+8
Stabilize `tcp_quickack` to stabilise the quickack part for now, tcp_deferaccept had been added at a later stage. The related API calls are the following ```rust // std::os::linux::net // sealed trait, implemented for std::net::TcpStream pub trait TcpStreamExt: Sealed{ fn quickack(&self) -> io::Result<bool>; fn set_quickack(&self, quickack: bool) -> io::Result<()>; } ``` Closes: https://github.com/rust-lang/rust/issues/96256
2025-06-09stabilize nonnull_provenanceRalf Jung-1/+0
2025-06-08Rollup merge of #142053 - heiher:loong32-none, r=wesleywiserJubilee-1/+4
Add new Tier-3 targets: `loongarch32-unknown-none*` MCP: https://github.com/rust-lang/compiler-team/issues/865 NOTE: LoongArch32 ELF object support is available starting with object v0.37.0.
2025-06-08De-duplicate f16 & f128 doctest attributesUrgau-134/+2