Commit graph

8498 commits

Author SHA1 Message Date
Guillaume Gomez
ff262bcb29
Rollup merge of #148970 - Ayush1325:uefi-fs-stat, r=joboet
std: sys: fs: uefi: Implement stat

- Implement std::fs::metadata function.
- Tested on qemu ovmf
2025-11-18 14:14:38 +01:00
Ayush Singh
6106760f31
std: sys: fs: uefi: Implement stat
- Implement std::fs::metadata function.
- Tested on qemu ovmf

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-18 15:11:08 +05:30
Matthias Krüger
c3af6292ec
Rollup merge of #147077 - joboet:mov_kernel_copy_sys, r=ibraheemdev
std: move `kernel_copy` to `sys`

Part of rust-lang/rust#117276.

The current organisation of the `kernel_copy` mechanism used to specialise `io::copy` on Linux necessitated circular links between the `io::copy` module and the implementation in `sys::pal::unix::kernel_copy`, as well as presenting an exception to the tidy PAL rule that forbids OS-based `#[cfg]`s outside of `sys` and `os`.

This PR fixes this by moving `kernel_copy` to `sys` (as per rust-lang/rust#117276) and returning a `CopyState` from that function specifying whether `io::copy` should use its fallback. The `kernel_copy` function on other platforms just unconditionally returns `CopyState::Fallback`.
2025-11-17 21:47:58 +01:00
Matthias Krüger
5dd82e8ed9
Rollup merge of #145610 - GrigorenkoPV:char_max_len, r=Amanieu
Stabilize `char_max_len`

Tracking issue: rust-lang/rust#121714

r? t-libs-api

`@rustbot` label +needs-fcp -T-libs +T-libs-api

Closes rust-lang/rust#121714
2025-11-17 18:07:31 +01:00
joboet
d870149672
std: move kernel_copy to sys 2025-11-17 17:44:21 +01:00
Matthias Krüger
046e09096e
Rollup merge of #148995 - RalfJung:extract_if, r=the8472
add must_use to extract_if methods

Also, mention the `.for_each(drop)` pattern in the documentation. One can't always use `retain` with a negated predicate as that does not have a range argument.

r? `@the8472`
2025-11-16 20:40:25 +01:00
Matthias Krüger
cb94a8411c
Rollup merge of #148971 - purplesyringa:pre-exec-error-constructor, r=Mark-Simulacrum
Document Error::{new,other} as to be avoided in pre_exec

This is a mistake I've found in many projects on GitHub and made myself. It's obvious that `Error::new`/`Error::other` allocate when you look at their signatures, and it's obvious that the `pre_exec` closure shouldn't allocate, but when you're asked to write a closure that returns a specific type, you don't expect its main constructor to be problematic.

I've included the list of 71 affected projects in a spoiler, though I don't expect anyone to look through it closely. It includes popular projects like alacritty, pika-backup, rio, rpm-ostree, and headcrab, as well as many smaller ones. For the most part, the snippets I've found are careful to only call functions from `libc`, `nix`, or `rustix`, so it's not a case of general incompetence, but something that just slipped through the cracks.

This docs section is already cluttered, so I've kept it terse.

If this is merged, I'd like to mass-post issues to the affected projects linking to this PR as a centralized source of information and place for discussion. Are there any objections about that?

`@rustbot` label +A-docs +A-process +O-unix +T-libs-api

<details>
<summary>List of affected projects</summary>

Format: links (witness of multi-threading)

- cccdfab32d/mdmcpsrvr/src/sandbox.rs (L385) (`tokio::main`)
- bf68154f9e/alacritty_terminal/src/tty/unix.rs (L250) (`thread::spawn`)
- 6a7f5aced0/rust/agent-core/src/sandbox.rs (L257) (`tokio::main`)
- 68673c836a/src/imageproxy.rs (L285) (`library`)
- 27f489edd2/gs/station/src/tui/app.rs (L69) (`thread::spawn`)
- 85e8b51010/src/manager.rs (L55) (`tokio::runtime::Builder::new_multi_thread`)
- 35d4756bc5/src/run.rs (L75) (`tokio::main`)
- 31f5353e55/golem_cli/src/command/yagna.rs (L384), 31f5353e55/test-utils/test-framework/src/yagna.rs (L103) (`actix_rt::main`)
- 2d797c5070/src/subprocess.rs (L14) (`thread::Builder::new`)
- 626feea965/opstation/src/manager/mod.rs (L50) (`none`)
- ca3b943248/crates/alacritty_terminal/src/tty/unix.rs (L256) (`thread::spawn`)
- 9dee27162f/feos/services/vm-service/src/vmm/ch_adapter.rs (L272) (`tokio::main`)
- d1aad75d9f/vopono_core/src/network/application_wrapper.rs (L193) (`thread::spawn`)
- 05b0c5ca7b/rust/agent-core/src/sandbox.rs (L261) (`tokio::main`)
- 2244f29a74/zaun/src/lib.rs (L157) (`library`)
- 179261a458/src/main.rs (L532) (`none`)
- 8deab3eee1/src/provider/mod.rs (L228) (`tokio::main`)
- e5ee289fc6/src/rust/process_execution/children/src/lib.rs (L44) (`tokio::main`)
- 297d21a2b0/pika-backup/src/utils.rs (L171) (`library`)
- 1c92330ccc/termproxy/src/main.rs (L290) (`none`)
- 3db85ed0bd/src/daemon/mod.rs (L181), 3db85ed0bd/src/daemon/orchestration.rs (L204) (`tokio::main`)
- c0d687a3a1/teletypewriter/src/unix/mod.rs (L551) (`library`)
- 2e76ab93b0/crates/security/src/access_restrictions.rs (L379) (`thread::spawn`)
- b1a76480bf/brush-core/src/sys/unix/commands.rs (L64) (`tokio::runtime::Runtime::new()`)
- b2c19ee783/alacritty_terminal/src/tty/unix.rs (L250) (`thread::spawn`)
- ad500f9fb4/src/app/process.rs (L82) (`tokio::main`)
- 0ad2ee53f3/rust/src/bwrap.rs (L100) (`thread::spawn`)
- 9d334572a8/microsandbox-utils/lib/runtime/supervisor.rs (L131) (`tokio::main`)
- eb2cd826b6/src/subcommands/run.rs (L62) (`library`)
- c013dda71e/shared/src/pty.rs (L216) (`tokio::main`)
- 33618aedf6/ai-terminal/src-tauri/src/command/core/execute_command.rs (L388) (`thread::spawn`)
- 97e6ba18f0/os_install_service/src/util.rs (L92) (`thread::spawn`)
- 462d487680/scripts/flitter/flitter.rs (L455) (`tokio::main`)
- 5d073ff0ea/crates/server/src/debugpy.rs (L43) (`thread::spawn`)
- ef3425da2b/example-crs-webservice/crs-multilang/uniafl/src/concolic/executor/symcc/symcc.rs (L216), ef3425da2b/example-crs-webservice/crs-multilang/uniafl/src/concolic/executor/symcc/symqemu.rs (L259) (`thread::spawn`)
- e2a34f3271/dbgee/src/os/linux.rs (L162) (`thread::spawn`)
- 22e54166ed/src/task_manager.rs (L87) (`tokio::main`)
- c55e294577/ovpnd/src/session_manager.rs (L32) (`tokio::main`)
- e5b6543e8f/like-strace/src/main.rs (L51) (`none`)
- 5ec161045b/src/main.rs (L166) (`none`)
- 765a773716/novnc_recorder/src/ffmpeg.rs (L11) (`thread::spawn`)
- 02967d9389/xlsynth-driver/src/prover.rs (L474) (`thread::spawn`)
- d2dcfff230/rustrc/src/stateful_process.rs (L37) (`tokio::main`)
- 9906f5c5a0/src/term/term.rs (L155) (`async_std::task::spawn`)
- 9c03e1d7ba/examples/bash.rs (L87) (`tokio::main`)
- 63c366f5c1/src/main.rs (L281) (`tokio::main`)
- d29c538c0c/src/lib.rs (L59) (`library`)
- fadcc96868/rvisor/src/sentry/platform/ptrace.rs (L21) (`none`)
- 3353fad862/src/reactor.rs (L76) (`thread::spawn`)
- 5a420c5da3/src/target/unix.rs (L55) (`library`)
- 2a69aa432a/src/lib.rs (L430) (`thread::spawn`)
- b59df7f112/src/process.rs (L89) (`thread::spawn`)
- 43b5572953/src/main.rs (L488) (`gtk`)
- c27801cc47/rustbox/src/executor.rs (L226) (`thread::spawn`)
- 967e6c9dea/src/lib.rs (L224) (`library`)
- ce093f81c6/caco3-pty/src/nixpty.rs (L67) (`library`)
- 531421e412/src/cli/background_start.rs (L69) (`thread::spawn`)
- 1b28305945/hypervisor/src/hypervisor/partition.rs (L258) (`thread::spawn`)
- 7c7d5fb774/rust-executor/src/executors/command.rs (L422) (`library`)
- 5146a95e29/src/lib.rs (L73) (`library`)
- 166e825c8a/os_install_service/src/util.rs (L92) (`thread::spawn`)
- 69845f7f06/src/pty/pseudo_terminal_pair.rs (L59), 69845f7f06/src/pty/pseudo_terminal_pair.rs (L63) (`tokio::main`)
- bf00423f70/src/invoker/src/worker/valuer.rs (L39) (`tokio::main`)
- 9c9fea1222/src/executor/process_manager.rs (L139) (`tokio::main`)
- 92c582fa21/src/main.rs (L166) (`none`)
- cbde17d1b1/src/bin/sadmin/persist_daemon.rs (L223) (`tokio::main`)
- c08b037747/src/unix/pty.rs (L48) (`library`)
- 5f699b6aaf/tail2/src/client/run.rs (L178) (`tokio::main`)
- 61dfc84215/src/pty.rs (L187) (`none`)
- 25a6ad7ff8/judge/src/sandbox.rs (L96) (`tokio::main`)
- 3447555afb/glycin/src/sandbox.rs (L335) (`library`)
</details>
2025-11-16 20:40:24 +01:00
Ralf Jung
fc07052f8b add must_use to extract_if methods 2025-11-16 15:57:23 +01:00
Stuart Cook
ec2f7397ce
Rollup merge of #148827 - GoldsteinE:stabilize-vec-into-raw-parts, r=Mark-Simulacrum
Stabilize vec_into_raw_parts

This stabilizes `Vec::into_raw_parts()` and `String::into_raw_parts()` per FCP in https://github.com/rust-lang/rust/issues/65816#issuecomment-3517630971. While this _does not_ stabilize `Vec::into_parts()`, I fixed up the examples that said they were waiting for `vec_into_raw_parts`. As `Vec::from_parts()` and `Vec::into_parts()` are covered by the same feature `box_vec_non_null`, any doctest that uses `Vec::from_parts()` can also use `Vec::into_parts()` (and same for allocator-aware versions).

Closes rust-lang/rust#65816

``@rustbot`` modify labels: +T-libs-api
2025-11-16 14:39:58 +11:00
bors
54f417673c Auto merge of #148526 - reddevilmidzy:docs, r=Mark-Simulacrum
Expand pow docs with special-case tests

resolve: rust-lang/rust#148316

Files changed:

* library/std/src/num: f32.rs, f64.rs,
  * powi
  * powf
* library/std/src/num: f16.rs, f128.rs
  * powf
* library/core/src/num: f16.rs, f128.rs
  * powi
* library/core/src/num: int_macros.rs, uint_macros.rs
  * checked_pow
  * strict_pow
  * saturating_pow
  * wrapping_pow
  * overflowing_pow
  * pow
2025-11-15 22:01:14 +00:00
Alisa Sireneva
33a6142ee0 Document Error::{new,other} as to be avoided in pre_exec 2025-11-15 12:30:16 +03:00
bors
42f4793e5a Auto merge of #138918 - Ayush1325:uefi-fs-time, r=joboet
uefi: fs: Add file times plumbing

- Add plumbing to allow conversions to and from UEFI Time to Rust SystemTime.
- Also add FileTimes implementation.

cc `@nicholasbishop`

r? `@petrochenkov`
2025-11-14 15:35:39 +00:00
Pavel Grigorenko
f9dcc6b21c Stabilize char_max_len 2025-11-14 18:23:19 +03:00
Stuart Cook
f61bfb0037
Rollup merge of #148725 - scottmcm:experiment-new-try-block-v3, r=petrochenkov
Implement the alternative `try` block desugaring

As discussed in https://github.com/rust-lang/rfcs/pull/3721#issuecomment-3208342727, update the `try` in nightly to match the RFC as a way to experiment.

This addresses the following unresolved issue from https://github.com/rust-lang/rust/issues/31436

>  Address issues with type inference (`try { expr? }?` currently requires an explicit type annotation somewhere).
2025-11-14 19:57:06 +11:00
Stuart Cook
e32379b445
Rollup merge of #148902 - folkertdev:detect-s390x-target-feature, r=tgross35
add missing s390x target feature to std detect test

Fix an oversight from https://github.com/rust-lang/rust/pull/145656, where the `is_s390x_feature_detected!` macro and some target features were stabilized, but other target features remain unstable under a new target feature name.

I tested this locally using a `stage1` build on the test file with the `s390x-unknown-linux-gnu` target.

cc ```@uweigand```
r? ```@Amanieu``` (or whoever really)
2025-11-14 13:14:07 +11:00
Folkert de Vries
776405c058
add missing s390x target feature to std detect test 2025-11-13 12:46:34 +01:00
Josh Triplett
199f308446 Guard against incorrect read_buf_exact implementations 2025-11-12 23:12:37 -08:00
Josh Triplett
65b5d765bc Implement Read::read_array
Tracking issue: https://github.com/rust-lang/rust/issues/148848
2025-11-11 16:18:50 -08:00
Max Siling
ac9bb13267
Stabilize vec_into_raw_parts 2025-11-11 20:24:29 +03:00
bors
2636cb4c13 Auto merge of #148818 - Zalathar:rollup-4vujcg0, r=Zalathar
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#148694 (std: support `RwLock` and thread parking on TEEOS)
 - rust-lang/rust#148712 (Port `cfg_select!` to the new attribute parsing system)
 - rust-lang/rust#148760 (rustc_target: hide TargetOptions::vendor)
 - rust-lang/rust#148771 (IAT: Reinstate early bailout)
 - rust-lang/rust#148775 (Fix a typo in the documentation for the strict_shr function)
 - rust-lang/rust#148779 (Implement DynSend and DynSync for std::panic::Location.)
 - rust-lang/rust#148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - rust-lang/rust#148783 (add test for assoc type norm wf check)
 - rust-lang/rust#148785 (Replace `master` branch references with `main`)
 - rust-lang/rust#148791 (fix "is_closure_like" doc comment)
 - rust-lang/rust#148792 (Prefer to use file.stable_id over file.name from source map)
 - rust-lang/rust#148805 (rustc-dev-guide subtree update)
 - rust-lang/rust#148807 (Document (and test) a problem with `Clone`/`Copy` deriving.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-11 13:30:50 +00:00
Stuart Cook
3150714f40
Rollup merge of #148694 - joboet:teeos-sync, r=ChrisDenton
std: support `RwLock` and thread parking on TEEOS

Since TEEOS supports pthread mutexes and condvars, it can share the pthread-based thread parking implementation and thus also the queue-based `RwLock` implementation used on other platforms.

CC ``@petrochenkov`` ``@Sword-Destiny``
2025-11-11 21:11:47 +11:00
Guillaume Gomez
40be1db6b8 Fix new function_casts_as_integer lint errors in core, std, panic_unwind and compiler crates 2025-11-10 16:38:28 +01:00
Ayush Singh
1f0ad37cb6
uefi: fs: Add file times plumbing
- Add FileTimes implementation.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-10 20:39:03 +05:30
reddevilmidzy
5d595cf8ba Expand pow docs with special-case tests 2025-11-10 14:56:05 +09:00
Matthias Krüger
243d494350
Rollup merge of #148687 - joboet:nonpoison-hook-rwlock, r=ChrisDenton
std: use a non-poisoning `RwLock` for the panic hook

The code ignored poison errors using `PoisonError` anyway.
2025-11-09 17:37:05 +01:00
Scott McMurray
86c3ba754a Implement the alternative try desugaring 2025-11-09 04:09:10 -08:00
bors
20f1c045c4 Auto merge of #148721 - Zalathar:rollup-398va3y, r=Zalathar
Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#128666 (Add `overflow_checks` intrinsic)
 - rust-lang/rust#146305 (Add correct suggestion for multi-references for self type in method)
 - rust-lang/rust#147179 ([DebugInfo] Fix container types failing to find template args)
 - rust-lang/rust#147743 (Show packed field alignment in mir_transform_unaligned_packed_ref)
 - rust-lang/rust#148079 (Rename `downcast_[ref|mut]_unchecked` -> `downcast_unchecked_[ref|mut]`)
 - rust-lang/rust#148084 (Optimize path components iteration on platforms that don't have prefixes)
 - rust-lang/rust#148126 (Fix rust stdlib build failing for VxWorks)
 - rust-lang/rust#148204 (Modify contributor email entries in .mailmap)
 - rust-lang/rust#148279 (rustc_builtin_macros: rename bench parameter to avoid collisions with user-defined function names)
 - rust-lang/rust#148333 (constify result unwrap unchecked)
 - rust-lang/rust#148539 (Add Allocator proxy impls for Box, Rc, and Arc)
 - rust-lang/rust#148601 (`invalid_atomic_ordering`: also lint `update` & `try_update`)
 - rust-lang/rust#148612 (Add note for identifier with attempted hygiene violation)
 - rust-lang/rust#148613 (Switch hexagon targets to rust-lld)
 - rust-lang/rust#148619 (Enable std locking functions on AIX)
 - rust-lang/rust#148644 ([bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`)
 - rust-lang/rust#148649 (don't completely reset `HeadUsages`)
 - rust-lang/rust#148673 (Remove a remnant of `dyn*` from the parser)
 - rust-lang/rust#148675 (Remove eslint-js from npm dependencies)
 - rust-lang/rust#148680 (Recover `[T: N]` as `[T; N]`)
 - rust-lang/rust#148688 (Remove unused argument `features` from `eval_config_entry`)
 - rust-lang/rust#148711 (Use the current lint note id when parsing `cfg!()`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-09 08:27:35 +00:00
Stuart Cook
9663de008a
Rollup merge of #148619 - amy-kwan:amyk/AddLockingFunctions_AIX, r=workingjubilee
Enable std locking functions on AIX

This patch enables the std locking functions on AIX by including AIX on the list of supported targets for the locking functions. Excluding AIX from the std locking functions results to compilation errors such as: ("try_lock() not supported").
2025-11-09 13:22:32 +11:00
Stuart Cook
5226e15770
Rollup merge of #148126 - hax0kartik:vx-fix-148125, r=Mark-Simulacrum
Fix rust stdlib build failing for VxWorks

Fixes rust-lang/rust#148125.

O_NOFOLLOW is not supported on VxWorks. All the other defines/functions have been added to libc(0cd5032671)
2025-11-09 13:22:27 +11:00
Stuart Cook
1ad9e955a8
Rollup merge of #148084 - the8472:prefixless-path-components-iter, r=Mark-Simulacrum
Optimize path components iteration on platforms that don't have prefixes

```
OLD

path::bench_path_components_iter 140.20ns/iter +/- 6.08
path::bench_path_file_name 57.62ns/iter +/- 1.62

NEW

path::bench_path_components_iter 126.74ns/iter +/- 1.46
path::bench_path_file_name 47.48ns/iter +/- 2.49
```
2025-11-09 13:22:26 +11:00
joboet
c2f56ef608
std: support RwLock and thread parking on TEEOS 2025-11-08 15:49:19 +01:00
joboet
52fd48c34f
std: use a non-poisoning RwLock for the panic hook 2025-11-08 09:27:30 +01:00
Amy Kwan
b827732898 Enable std locking functions on AIX
This patch enables the std locking functions on AIX by including AIX on the list
of supported targets for the locking functions. Excluding AIX from the std
locking functions results to compilation errors such as: ("try_lock() not supported").
2025-11-07 04:36:12 +00:00
Folkert de Vries
c59298da36
stabilize stdarch_s390x_feature_detection 2025-11-06 12:49:46 +01:00
Stuart Cook
6e03719029
Rollup merge of #148495 - ChrisDenton:path_is_empty, r=workingjubilee
Implement Path::is_empty

This implements `Path::is_empty` which is simply a convenience wrapper for `path.as_os_str().is_empty()`.

Tracking issue: https://github.com/rust-lang/rust/issues/148494
ACP: https://github.com/rust-lang/libs-team/issues/687
2025-11-05 10:59:20 +11:00
Chris Denton
7e66d6c3b9
Implement Path::is_empty 2025-11-04 19:23:51 +00:00
Stuart Cook
5eef85cc9b
Rollup merge of #146301 - Ayush1325:uefi-box, r=joboet
library: std: sys: net: uefi: tcp: Implement write_vectored

- A working vectored write implementation for TCP4.
- Also introduces a small helper UefiBox intended to be used with heap allocated UEFI DSTs.
- Tested on OVMF

cc ```@nicholasbishop```
2025-11-04 13:44:49 +11:00
Guillaume Gomez
871692a278
Rollup merge of #148378 - ilai-deutel:update_hook-doc, r=joboet
Fix documentation for std::panic::update_hook

The equivalent code given in the documentation of `std::panic::update_hook`[^1] does not compile:

* `set_hook` expects a boxed function
* Missing closing delimiter for the closure

[^1]: rust-lang/rust#92649
2025-11-03 17:20:38 +01:00
Matthias Krüger
0a9018b919
Rollup merge of #148135 - hax0kartik:fix-vx-unix-sock, r=Mark-Simulacrum
Ignore unix socket related tests for VxWorks

Unix Sockets are not implemented in VxWorks, and therefore, ignore testcases related to UnixDatagram, UnixListener and UnixStream.
2025-11-02 20:21:02 +01:00
Matthias Krüger
2afb64ed71
Rollup merge of #148026 - joboet:dont-leak-thread-closure, r=Mark-Simulacrum
std: don't leak the thread closure if destroying the thread attributes fails

The comment about double-free is wrong – we can safely drop both the thread attributes and the thread closure. Here, I've used `DropGuard` for the attributes and moved the `Box::into_raw` to just before the `pthread_create`.
2025-11-02 20:21:01 +01:00
Ilaï Deutel
b9e127a830 Fix documentation for std::panic::update_hook
* `set_hook` expects a boxed function
* Missing closing delimiter for the closure
2025-11-01 23:46:35 -04:00
Ayush Singh
471f2ba64e
library: std: sys: net: uefi: tcp: Implement write_vectored
- A working vectored write implementation for TCP4.
- Also introduces a small helper UefiBox intended to be used with heap
  allocated UEFI DSTs.
- Tested on OVMF

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-02 00:23:21 +05:30
bors
fca2e941f8 Auto merge of #148356 - matthiaskrgr:rollup-mh4l2yi, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#135602 (Tweak output of missing lifetime on associated type)
 - rust-lang/rust#139751 (Implement pin-project in pattern matching for `&pin mut|const T`)
 - rust-lang/rust#142682 (Update bundled musl to 1.2.5)
 - rust-lang/rust#148171 (Simplify code to generate line numbers in highlight)
 - rust-lang/rust#148263 (Unpin `libc` and `rustix` in `compiler` and `rustbook`)
 - rust-lang/rust#148301 ([rustdoc search] Include extern crates when filtering on `import`)
 - rust-lang/rust#148330 (Don't require dlltool with the dummy backend on MinGW)
 - rust-lang/rust#148338 (cleanup: upstream dropped amx-transpose functionality)
 - rust-lang/rust#148340 (Clippy subtree update)
 - rust-lang/rust#148343 (`nonpoison::Condvar` should take `MutexGuard` by reference)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-01 16:44:42 +00:00
Connor Tsui
c1153b08ff
move condvar test from mutex to condvar test file
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-10-31 15:53:39 -04:00
Connor Tsui
3d5a40809c
update nonpoison::Condvar to take guards by reference
Since non-poisoning `Condvar` take non-poisoing `Mutex`es when
`wait`ing, we do not need to take by ownership since a poison error
cannot occur while we wait.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-10-31 15:53:33 -04:00
Connor Tsui
7069400c47
revert combined nonpoison/poison tests for condvar
Setup for writing different tests for the `nonpoison::Condvar` since it
will have a different API.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-10-31 15:31:53 -04:00
Matthias Krüger
eaa283deca
Rollup merge of #148322 - oxidecomputer:ea-flock-illumos, r=ChrisDenton
Enable file locking support in illumos

https://github.com/rust-lang/rust/pull/132977 introduced an allow-list of targets supporting file locking, but forgot to add illumos to it (which introduced support for it in ~2015). `File::lock` and friends are now stable, and the ecosystem is slowly replacing custom libc calls with the standard library. Crucially, in 1.91 both Cargo and bootstrap switched to `File::lock`, both breaking build directory locking.

This PR enables file locking on illumos. Fixes https://github.com/rust-lang/rust/issues/146312.
2025-10-31 18:41:52 +01:00
Matthias Krüger
c438dbd035
Rollup merge of #147986 - jesseschalken:use-fstatat-macos, r=joboet
Use fstatat() in DirEntry::metadata on Apple platforms

Apple supports `fstatat` on macOS >=10.10 ([source](https://gitlab.gnome.org/GNOME/glib/-/issues/2203)), and according to [Platform Support](https://doc.rust-lang.org/beta/rustc/platform-support.html) the oldest supported version is 10.12.

Google says iOS >=10 supports `fstatat` but doesn't provide a source. [*-apple-ios](https://doc.rust-lang.org/beta/rustc/platform-support/apple-ios.html#os-version) says the minimum supported iOS version is 10.0.

Unsure about tvOS, watchOS and visionOS, hoping CI can confirm this.

I am testing with [fastdu](https://github.com/jesseschalken/fastdu) which is effectively a stress test for `DirEntry::metadata`. In one test this provides a **1.13x** speedup.

```
$ hyperfine --warmup 1 'target/release/fastdu testdir' 'fastdu testdir'
Benchmark 1: target/release/fastdu testdir
  Time (mean ± σ):     154.6 ms ±  17.4 ms    [User: 31.7 ms, System: 187.6 ms]
  Range (min … max):   148.4 ms … 225.5 ms    19 runs

Benchmark 2: fastdu testdir
  Time (mean ± σ):     175.3 ms ±  15.8 ms    [User: 50.0 ms, System: 196.2 ms]
  Range (min … max):   165.4 ms … 211.7 ms    17 runs

Summary
  target/release/fastdu testdir ran
    1.13 ± 0.16 times faster than fastdu testdir
```

You can also reproduce a speedup with a program like this (providing a directory with many entries):

```rust
fn main() {
    let args: Vec<_> = std::env::args_os().collect();
    let dir: PathBuf = args[1].clone().into();

    for entry in dir.read_dir().as_mut().unwrap() {
        let entry = entry.as_ref().unwrap();
        let metadata = entry.metadata();
        let metadata = metadata.as_ref().unwrap();
        println!("{} {}", metadata.len(), entry.file_name().display());
    }
}
```

```
$ hyperfine './target/release/main testdir' './main testdir'
Benchmark 1: ./target/release/main testdir
  Time (mean ± σ):     148.3 ms ±   5.2 ms    [User: 23.1 ms, System: 122.9 ms]
  Range (min … max):   145.2 ms … 167.2 ms    19 runs

Benchmark 2: ./main testdir
  Time (mean ± σ):     164.4 ms ±   9.5 ms    [User: 32.6 ms, System: 128.8 ms]
  Range (min … max):   158.5 ms … 199.5 ms    17 runs

Summary
  ./target/release/main testdir ran
    1.11 ± 0.07 times faster than ./main testdir
```
2025-10-31 18:41:50 +01:00
Emily Albini
3d9c69b594 enable flock for illumos 2025-10-31 12:41:54 +01:00
Josh Stone
f25ca45fd1 Update CURRENT_RUSTC_VERSION post-bump
(cherry picked from commit 813072186c)
2025-10-28 13:22:00 -07:00