Commit Graph

8526 Commits

Author SHA1 Message Date
bors 1be6b13be7 Auto merge of #149079 - zachs18:clone_from_ref, r=Mark-Simulacrum
Add `Box::clone_from_ref` and similar under `feature(clone_from_ref)`

Tracking issue: https://github.com/rust-lang/rust/issues/149075

Accepted ACP: https://github.com/rust-lang/libs-team/issues/483

This PR implements `clone_from_ref` (and `try_*` and `_*in` variants), to get a `Box<T>`, `Arc<T>`, or `Rc<T>` by cloning from a `&T` where `T: CloneToUninit`.

The "Implement..." commits replace some ad-hoc conversions with `clone_from_ref` variants, which can be split out to a separate PR if desired.

This PR will conflict with https://github.com/rust-lang/rust/pull/148769 due to usage of `Layout::dangling` (which that PR is renaming to `dangling_ptr`), so they should not be rolled up together, and the one which merges later will need to be amended.
2025-11-26 18:21:00 +00:00
Matthew Maurer 17230eb5bb rustc_target: aarch64: Remove deprecated FEAT_TME
ARM has withdrawn FEAT_TME

https://developer.arm.com/documentation/102105/lb-05/

LLVM has dropped support for it recently as a result.
2025-11-25 00:43:01 +00:00
Peter Badida 6173a56716 Fix missing double-quote in std::env::consts::OS values 2025-11-24 18:02:24 +01:00
Matthias Krüger be4c672cbc Rollup merge of #149204 - winningMove:patch-1, r=chenyukang
Fix typo in HashMap performance comment
2025-11-22 18:41:25 +01:00
Matthias Krüger a2138ef8e6 Rollup merge of #148407 - Urgau:suspicious_int_mutable_consts, r=JonathanBrouwer
Warn against calls which mutate an interior mutable `const`-item

## `const_item_interior_mutations`

~~`interior_mutable_const_item_mutations`~~

~~`suspicious_mutation_of_interior_mutable_consts`~~

*warn-by-default*

The `const_item_interior_mutations` lint checks for calls which mutates an interior mutable const-item.

### Example

```rust
use std::sync::Once;

const INIT: Once = Once::new(); // using `INIT` will always create a temporary and
                                // never modify it-self on use, should be a `static`
                                // instead for shared use

fn init() {
    INIT.call_once(|| {
        println!("Once::call_once first call");
    });
}
```

```text
warning: mutation of an interior mutable `const` item with call to `call_once`
  --> a.rs:11:5
   |
11 |       INIT.call_once(|| {
   |       ^---
   |       |
   |  _____`INIT` is a interior mutable `const` item of type `std::sync::Once`
   | |
12 | |         println!("Once::call_once first call");
13 | |     });
   | |______^
   |
   = note: each usage of a `const` item creates a new temporary
   = note: only the temporaries and never the original `const INIT` will be modified
   = help: for more details on interior mutability see <https://doc.rust-lang.org/reference/interior-mutability.html>
   = note: `#[warn(const_item_interior_mutations)]` on by default
help: for a shared instance of `INIT`, consider making it a `static` item instead
   |
 6 - const INIT: Once = Once::new(); // using `INIT` will always create a temporary and
 6 + static INIT: Once = Once::new(); // using `INIT` will always create a temporary and
   |
```

### Explanation

Calling a method which mutates an interior mutable type has no effect as const-item are essentially inlined wherever they are used, meaning that they are copied directly into the relevant context when used rendering modification through interior mutability ineffective across usage of that const-item.

The current implementation of this lint only warns on significant `std` and `core` interior mutable types, like `Once`, `AtomicI32`, ... this is done out of prudence and may be extended in the future.

----

This PR is an targeted alternative to rust-lang/rust#132146. It avoids false-positives by adding an internal-only attribute `#[rustc_should_not_be_called_on_const_items]` on methods and functions that mutates an interior mutale type through a shared reference (mutable refrences are already linted by the `const_item_mutation` lint).

It should also be noted that this is NOT an uplift of the more general [`clippy::borrow_interior_mutable_const`](https://rust-lang.github.io/rust-clippy/master/index.html#/borrow_interior_mutable_const) lint, which is a much more general lint regarding borrow of interior mutable types, but has false-positives that are completly avoided by this lint.

A simple [GitHub Search](https://github.com/search?q=lang%3Arust+%2F%28%3F-i%29const+%5Ba-zA-Z0-9_%5D*%3A+Once%2F&type=code) reveals many instance where the user probably wanted to use a `static`-item instead.

----

````@rustbot```` labels +I-lang-nominated +T-lang
cc ````@traviscross````
r? compiler

Fixes [IRLO - Forbidding creation of constant mutexes, etc](https://internals.rust-lang.org/t/forbidding-creation-of-constant-mutexes-etc/19005)
Fixes https://github.com/rust-lang/rust/issues/132028
Fixes https://github.com/rust-lang/rust/issues/40543
2025-11-22 18:41:20 +01:00
Urgau 0e8d1e1f8e Add #[rustc_should_not_be_called_on_const_items] to std methods 2025-11-22 14:48:35 +01:00
bors 1dd43f247e Auto merge of #149159 - cuviper:library-hashbrown-0.16.1, r=Amanieu
library: upgrade to hashbrown v0.16.1

This is another step toward unspecializing `Copy`.

See also rust-lang/rust#135634 and rust-lang/hashbrown#662

r? `@Amanieu`
cc `@joboet`
2025-11-22 09:40:59 +00:00
winningMove 8094934b9a Fix typo in HashMap performance comment 2025-11-22 10:37:31 +01:00
Stuart Cook e397c5ddc1 Rollup merge of #149134 - Ayush1325:uefi-tcp4-vector, r=joboet
std: sys: net: uefi: Implement read_vectored

- Basically a copy of write_vectored [0]
- Tested on QEMU ovmf.

[0]: https://github.com/rust-lang/rust/pull/146301
2025-11-21 14:44:43 +11:00
Josh Stone 3a56d492de library: upgrade to hashbrown v0.16.1 2025-11-20 11:12:31 -08:00
Matthias Krüger df178d9a15 Rollup merge of #149123 - Ayush1325:uefi-fs-size-fix, r=ChrisDenton
std: sys: fs: uefi: Fix FileAttr size

- The underlying file size is represented by file_size field. The size field is just the size of structure since it is a C DST.
- Fixes bug created in https://github.com/rust-lang/rust/pull/148970

``@rustbot`` label +O-UEFI
2025-11-20 20:11:45 +01:00
Matthias Krüger 3e99b85073 Rollup merge of #149113 - RalfJung:sgx-less-unsafe, r=ChrisDenton
sgx: avoid unnecessarily creating a slice

Cc ``@jethrogb`` -- no idea why this created a slice only to directly convert it back to a raw pointer, but we can avoid this and in fact make the entire function safe. I didn't change the function signature (it's still an `unsafe fn`) as I know nothing about the surrounding code.
2025-11-20 20:11:44 +01:00
Matthias Krüger 001158a793 Rollup merge of #149111 - tgross35:fs-test-updates, r=ChrisDenton
fs: Run file lock tests on all platforms that support it

There are a number of platforms that support file locking but aren't getting tested. Synchronize the list and mark the tests `should_panic` otherwise, to make sure they get updated if more platforms add locking support.

The supported platform list comes from https://github.com/rust-lang/rust/blob/07bdbaedc63094281483c40a88a1a8f2f8ffadc5/library/std/src/sys/fs/unix.rs#L1291-L1308. Windows also supports file locks, all other platforms are unsupported.
2025-11-20 20:11:44 +01:00
Matthias Krüger ad2266b8d0 Rollup merge of #149088 - ximon18:patch-1, r=ChrisDenton
Add missing trailing period to RustDoc for fn create_dir().

Documentation for other functions in the standard library RustDocs have a trailing period at the end of the first sentence, e.g. `create_dir_all()` and `create_buffered()` have the trailing period, but the first line of documentation for `fn create_dir()` lacks a trailing period. This PR adds the missing period.
2025-11-20 20:11:43 +01:00
Ayush Singh 3f08502242 std: sys: net: uefi: Implement read_vectored
- Basically a copy of write_vectored [0]
- Tested on QEMU ovmf.

[0]: https://github.com/rust-lang/rust/pull/146301

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-20 15:50:19 +05:30
Ralf Jung 7ad3c5c4f8 sgx: avoid unnecessarily creating a slice 2025-11-20 08:11:43 +01:00
Ayush Singh ea3fe53ac0 std: sys: fs: uefi: Fix FileAttr size
- The underlying file size is represented by file_size field. The size
  field is just the size of structure since it is a C DST.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-20 10:13:11 +05:30
Trevor Gross cea9dd8dc8 test: Use an ignore message for fs Android skips 2025-11-19 16:29:48 -06:00
Trevor Gross 4bf24d2b54 fs: Expect a test failure if file locks aren't supported
Rather than skipping the tests, make sure that they fail. This ensures
that if file locking support is added for more platforms in the future,
the tests don't wind up quietly skipped.
2025-11-19 16:29:48 -06:00
Trevor Gross 8c4e3ff0a6 fs: Update skipped file lock tests to match flock support
The list of platforms for which file locks are tested is smaller than
the list of platforms that support it. Synchronize these here.

Link: https://github.com/rust-lang/rust/blob/07bdbaedc63094281483c40a88a1a8f2f8ffadc5/library/std/src/sys/fs/unix.rs#L1291-L1308
2025-11-19 14:36:51 -06:00
Zachary S 316d54a5bd Implement some conversions using Box::clone_from_ref 2025-11-19 13:34:03 -06:00
Zachary S 9e497b6071 Add Box::(try_)clone_from_ref(_in) 2025-11-19 13:34:00 -06:00
Ximon Eighteen 9f49ac385a Add missing trailing period to RustDoc for fn create_dir(). 2025-11-19 11:03:00 +01:00
Matthias Krüger 48fa9138c3 Rollup merge of #148798 - tamird:esc-single-quote, r=Amanieu
Match <OsString as Debug>::fmt to that of str

Fixes rust-lang/rust#114583.
2025-11-19 09:48:10 +01:00
Matthias Krüger 3732c3c068 Rollup merge of #148201 - ZuseZ4:autodiff-activity-docs, r=oli-obk
Start documenting autodiff activities

Some initial documentation of the autodiff macros and usage examples
2025-11-19 09:48:08 +01:00
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
Tamir Duberstein eb84efc702 Remove <os::Vars as Debug> workaround 2025-11-17 16:05:01 -05:00
Tamir Duberstein 1cfd0b7c55 Match <OsString as Debug>::fmt to that of str
819247f1 changed <str as Debug>::fmt such that it does not escape single
quotes, but neglected to apply the same choice to OsString. This commit
does that.
2025-11-17 16:05:00 -05:00
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
Manuel Drehwald f5892da3f2 add autodiff examples 2025-11-16 23:35:37 -05: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)

- https://github.com/0x4D44/mdmcp/blob/cccdfab32d5a203d03ccbc6ed261a2f4a4e6420d/mdmcpsrvr/src/sandbox.rs#L385 (`tokio::main`)
- https://github.com/alacritty/alacritty/blob/bf68154f9e4b91e5ba21dfb8151dbde23c46d47d/alacritty_terminal/src/tty/unix.rs#L250 (`thread::spawn`)
- https://github.com/AsterZephyr/polyagent/blob/6a7f5aced0335926941931ca965e5455890a7ce3/rust/agent-core/src/sandbox.rs#L257 (`tokio::main`)
- https://github.com/bootc-dev/containers-image-proxy-rs/blob/68673c836a91070811c17858183266e634f9719d/src/imageproxy.rs#L285 (`library`)
- https://github.com/delft-hyperloop/DH09-sw/blob/27f489edd297e9b93b8caa2c0b222ae8a9f1a70f/gs/station/src/tui/app.rs#L69 (`thread::spawn`)
- https://github.com/fcoury/oxproc/blob/85e8b510102d1caf7f15fd88694b4ad24bcd59b7/src/manager.rs#L55 (`tokio::runtime::Builder::new_multi_thread`)
- https://github.com/galqiwi/runner/blob/35d4756bc518b5947e0275e4251b674c8c354b62/src/run.rs#L75 (`tokio::main`)
- https://github.com/golemfactory/yagna/blob/31f5353e5532e947abb824adc30791583d01bf74/golem_cli/src/command/yagna.rs#L384, https://github.com/golemfactory/yagna/blob/31f5353e5532e947abb824adc30791583d01bf74/test-utils/test-framework/src/yagna.rs#L103 (`actix_rt::main`)
- https://github.com/greshake/i3status-rust/blob/2d797c50702873fc8efe518156e204a0b3979fc8/src/subprocess.rs#L14 (`thread::Builder::new`)
- https://github.com/hattmo/projects/blob/626feea965cebd90490e3e16f2c4b0c6725212e1/opstation/src/manager/mod.rs#L50 (`none`)
- https://github.com/iamazy/nxshell/blob/ca3b94324831cdc8f8b533c1ff252bdeeba3acbf/crates/alacritty_terminal/src/tty/unix.rs#L256 (`thread::spawn`)
- https://github.com/ironcore-dev/FeOS/blob/9dee27162f5860991dc176bf2e0d9f948dc97d5b/feos/services/vm-service/src/vmm/ch_adapter.rs#L272 (`tokio::main`)
- https://github.com/jamesmcm/vopono/blob/d1aad75d9fc8959488e020f3ffea6ffd1f798609/vopono_core/src/network/application_wrapper.rs#L193 (`thread::spawn`)
- https://github.com/Kocoro-lab/Shannon/blob/05b0c5ca7b65b2d2c2c8be83906b37d5307718e7/rust/agent-core/src/sandbox.rs#L261 (`tokio::main`)
- https://github.com/kolloch/zack/blob/2244f29a74f74401abd8869c50c7d868afd656b9/zaun/src/lib.rs#L157 (`library`)
- https://github.com/MaxVerevkin/wlr-which-key/blob/179261a45867544f2b3c25871b8ef77c6f9bdf43/src/main.rs#L532 (`none`)
- https://github.com/openanolis/cryptpilot/blob/8deab3eee1d6488f6578f6284d0494c70ce7f6b4/src/provider/mod.rs#L228 (`tokio::main`)
- https://github.com/pantsbuild/pants/blob/e5ee289fc67a02a8d011f3fd160e8544727bd613/src/rust/process_execution/children/src/lib.rs#L44 (`tokio::main`)
- https://github.com/pika-backup/pika-backup/blob/297d21a2b02dc7230c2d8e7cf86289d25ba82de1/pika-backup/src/utils.rs#L171 (`library`)
- https://github.com/proxmox/pve-xtermjs/blob/1c92330cccb21fb65abcff6e35848b712592dccb/termproxy/src/main.rs#L290 (`none`)
- https://github.com/rand/mnemosyne/blob/3db85ed0bde68f25c38fb4a77c6cac50fa638d52/src/daemon/mod.rs#L181, https://github.com/rand/mnemosyne/blob/3db85ed0bde68f25c38fb4a77c6cac50fa638d52/src/daemon/orchestration.rs#L204 (`tokio::main`)
- https://github.com/raphamorim/rio/blob/c0d687a3a1a439dbe81405d805c3dc191c90c45f/teletypewriter/src/unix/mod.rs#L551 (`library`)
- https://github.com/rawkode/cuenv/blob/2e76ab93b0faa25a53094406e7f5f1ca15e32068/crates/security/src/access_restrictions.rs#L379 (`thread::spawn`)
- https://github.com/reubeno/brush/blob/b1a76480bf000bb2d351b65c2012eb06f88fa0ae/brush-core/src/sys/unix/commands.rs#L64 (`tokio::runtime::Runtime::new()`)
- https://github.com/sebosp/chartacritty/blob/b2c19ee7836ca3d939fff045cad93182749cc0ea/alacritty_terminal/src/tty/unix.rs#L250 (`thread::spawn`)
- https://github.com/skanehira/ghost/blob/ad500f9fb47b7266e6d5989b0232881efe1bfa87/src/app/process.rs#L82 (`tokio::main`)
- https://github.com/coreos/rpm-ostree/blob/0ad2ee53f3c2d77bc4adfd618d865e919c943865/rust/src/bwrap.rs#L100 (`thread::spawn`)
- https://github.com/zerocore-ai/microsandbox/blob/9d334572a821775070de68d7cb20f1b2b65da9c3/microsandbox-utils/lib/runtime/supervisor.rs#L131 (`tokio::main`)
- https://github.com/willfindlay/bpfcontain-rs/blob/eb2cd826b609e165d63d784c0f562b7a278171d2/src/subcommands/run.rs#L62 (`library`)
- https://github.com/willothy/sesh/blob/c013dda71e69d59de3e23c08aa7fc4f71c8e087c/shared/src/pty.rs#L216 (`tokio::main`)
- https://github.com/AiTerminalFoundation/ai-terminal/blob/33618aedf66229ee5075519640344fef44b058e1/ai-terminal/src-tauri/src/command/core/execute_command.rs#L388 (`thread::spawn`)
- https://github.com/Toromino/chromiumos-platform2/blob/97e6ba18f0e5ab6723f3448a66f82c1a07538d87/os_install_service/src/util.rs#L92 (`thread::spawn`)
- https://github.com/jimmyff/nixfiles/blob/462d487680d91b25a74f69ce2509e519504ea5de/scripts/flitter/flitter.rs#L455 (`tokio::main`)
- https://github.com/simonrw/dap-gui/blob/5d073ff0ea4e99ba94af6c0137c089418ead5298/crates/server/src/debugpy.rs#L43 (`thread::spawn`)
- https://github.com/Team-Atlanta/aixcc-afc-atlantis/blob/ef3425da2bc8951afcfe419913e88b064eb3bcf0/example-crs-webservice/crs-multilang/uniafl/src/concolic/executor/symcc/symcc.rs#L216, https://github.com/Team-Atlanta/aixcc-afc-atlantis/blob/ef3425da2bc8951afcfe419913e88b064eb3bcf0/example-crs-webservice/crs-multilang/uniafl/src/concolic/executor/symcc/symqemu.rs#L259 (`thread::spawn`)
- https://github.com/nullpo-head/dbgee/blob/e2a34f3271ee7e100eeccd8e00f8a50729ef0f1a/dbgee/src/os/linux.rs#L162 (`thread::spawn`)
- https://github.com/KingBright/training_manager/blob/22e54166ed4e153e05b6902d7d8661a6a4b5e31a/src/task_manager.rs#L87 (`tokio::main`)
- https://github.com/SparkyTD/ovpn/blob/c55e2945776ab0da0616707315141a5a04c4129c/ovpnd/src/session_manager.rs#L32 (`tokio::main`)
- https://github.com/FulanXisen/like/blob/e5b6543e8f1729e410439e1e50ceed1fdc9fddc2/like-strace/src/main.rs#L51 (`none`)
- https://github.com/patrickdappollonio/dotenv/blob/5ec161045b21c5548f867cae637bea64bea59550/src/main.rs#L166 (`none`)
- https://github.com/jefflouisma/KasmVNCPlus/blob/765a77371645cbbba5b639f49591c251aa97f363/novnc_recorder/src/ffmpeg.rs#L11 (`thread::spawn`)
- https://github.com/xlsynth/xlsynth-crate/blob/02967d938910cf23a09e93ffb3284e50c1e11d7d/xlsynth-driver/src/prover.rs#L474 (`thread::spawn`)
- https://github.com/M00NLIG7/pandoras_box/blob/d2dcfff230426688af6d6770899d9865d27b5733/rustrc/src/stateful_process.rs#L37 (`tokio::main`)
- https://github.com/bendiksolheim/term/blob/9906f5c5a0115fc330ac6c56e947d41c4ad78545/src/term/term.rs#L155 (`async_std::task::spawn`)
- https://github.com/yskszk63/ssssh/blob/9c03e1d7bab2b1cdc52892d4c28e11daf639bd94/examples/bash.rs#L87 (`tokio::main`)
- https://github.com/jarhodes314/tcp-buffer-test/blob/63c366f5c1dd940f9a392fc73be653c0c0d81b4c/src/main.rs#L281 (`tokio::main`)
- https://github.com/luser/spawn-ptrace/blob/d29c538c0c81ac1d62f19cee8be48e4ab0926392/src/lib.rs#L59 (`library`)
- https://github.com/OSH-2020/x-chital/blob/fadcc96868b619f4463c95edd01b71f23fb20c13/rvisor/src/sentry/platform/ptrace.rs#L21 (`none`)
- https://github.com/sbstp/supermon/blob/3353fad862970eb54c293c63dda9980539e1ac0b/src/reactor.rs#L76 (`thread::spawn`)
- https://github.com/headcrab-rs/headcrab/blob/5a420c5da3f51196cd991680bb2b3fded6ce7033/src/target/unix.rs#L55 (`library`)
- https://github.com/taoky/greenhook/blob/2a69aa432ab7fd4eee68eea2a2b4dbec845165cc/src/lib.rs#L430 (`thread::spawn`)
- https://github.com/saltnpepper97/snug/blob/b59df7f112f059f144c7a32c00bd8ad73a7d584d/src/process.rs#L89 (`thread::spawn`)
- https://github.com/regiontog/WebDM/blob/43b557295316668a975466354d86703f7ad3dd2d/src/main.rs#L488 (`gtk`)
- https://github.com/KailasMahavarkar/rustbox/blob/c27801cc479c75fec6c12a08272d507793769871/rustbox/src/executor.rs#L226 (`thread::spawn`)
- https://github.com/roboplc/virtual-terminal/blob/967e6c9dea5455c7f7f3b9276b88abb445009a3a/src/lib.rs#L224 (`library`)
- https://github.com/nui/caco3/blob/ce093f81c6a57dd9172894e7d5ab28d2984f5cc8/caco3-pty/src/nixpty.rs#L67 (`library`)
- https://github.com/nohackjustnoobb/Macro-Deck-Driver/blob/531421e41266ca952cf7c62644da0194877c1e24/src/cli/background_start.rs#L69 (`thread::spawn`)
- https://github.com/ManishaChavva/a653rs-linux/blob/1b2830594519d9eff3779f6cd22795dbe14f8d54/hypervisor/src/hypervisor/partition.rs#L258 (`thread::spawn`)
- https://github.com/rhinos0608/codecrucible-synth/blob/7c7d5fb7743116a2a94c3156dee43439675a4e2e/rust-executor/src/executors/command.rs#L422 (`library`)
- https://github.com/Nughm3/sandbox/blob/5146a95e29b198b85c496077dc096bbe1e882d23/src/lib.rs#L73 (`library`)
- https://github.com/naverwhale/whaleos-platform2/blob/166e825c8a43753dda3b021c5519124842d1d8d5/os_install_service/src/util.rs#L92 (`thread::spawn`)
- https://github.com/de-vri-es/webterm-server-rs/blob/69845f7f0678dce942de8313d6d4b0a57f83a9a9/src/pty/pseudo_terminal_pair.rs#L59, https://github.com/de-vri-es/webterm-server-rs/blob/69845f7f0678dce942de8313d6d4b0a57f83a9a9/src/pty/pseudo_terminal_pair.rs#L63 (`tokio::main`)
- https://github.com/jjs-dev/jjs/blob/bf00423f70f8a6ed508bbcb8b38840225e43cc73/src/invoker/src/worker/valuer.rs#L39 (`tokio::main`)
- https://github.com/Drumblow/seac/blob/9c9fea1222ab98aee25376b51de8a66fe0eb4676/src/executor/process_manager.rs#L139 (`tokio::main`)
- https://github.com/CJacob314/rustcon/blob/92c582fa21fc68bb8740f617455820c3377a0274/src/main.rs#L166 (`none`)
- https://github.com/antialize/simple-admin/blob/cbde17d1b132be8427340fcc55f82958641d32a6/src/bin/sadmin/persist_daemon.rs#L223 (`tokio::main`)
- https://github.com/jonathanforhan/pty-exec/blob/c08b037747aa049cd7d41d6ea8de02305775d789/src/unix/pty.rs#L48 (`library`)
- https://github.com/0b01/tail2/blob/5f699b6aafb4c5be677c21e8f619c35bca33efcf/tail2/src/client/run.rs#L178 (`tokio::main`)
- https://github.com/owtaylor/ttymon/blob/61dfc842151c1e45920c427471617cbb27caff0d/src/pty.rs#L187 (`none`)
- https://github.com/Nughm3/contest-platform/blob/25a6ad7ff84550f5a2b32f270660acdd010e5a93/judge/src/sandbox.rs#L96 (`tokio::main`)
- https://github.com/valoq/glycin/blob/3447555afb60245f4e2329f129c921573f077d1b/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