Commit Graph

8706 Commits

Author SHA1 Message Date
bors 9eb3be26b4 Auto merge of #156720 - JonathanBrouwer:rollup-vArjiS4, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#156709 (stdarch subtree update)
 - rust-lang/rust#155006 (stabilize `feature(cfg_target_has_atomic_equal_alignment)`)
 - rust-lang/rust#156444 (Implement `OsStr::split_at`)
 - rust-lang/rust#156582 (Allow `global_asm!` in statement positions)
 - rust-lang/rust#156661 (Remove `UncheckedIterator`)
 - rust-lang/rust#152367 (Derives `Copy` for `ffi::FromBytesUntilNulError`)
 - rust-lang/rust#156443 (Fix invalid suggestion for parenthesized break)
 - rust-lang/rust#156606 (Add pext/pdep as aliases for extract_bits/deposit_bits)
 - rust-lang/rust#156630 (Replace `println!` with `assert!` in HashMap documentation examples)
 - rust-lang/rust#156644 (Widen the result of `widening_mul`.)
 - rust-lang/rust#156653 (Update `sysinfo` version to `0.39.2`)
 - rust-lang/rust#156697 (Add diagnostic items for IoBufReader and StdinLock)
 - rust-lang/rust#156704 (reduce usage of `box_patterns` in tests)
2026-05-18 18:00:20 +00:00
Jonathan Brouwer 4cce3530bb Rollup merge of #156697 - JaafarTanoukhi:iobufreader-stdinlock-diag-items, r=mejrs
Add diagnostic items for IoBufReader and StdinLock

Added two new diagnostic items for IoBufReader and StdinLock.
2026-05-18 17:07:13 +02:00
Jonathan Brouwer a26a65252f Rollup merge of #156630 - BowLuckie:main, r=clarfonthey
Replace `println!` with `assert!` in HashMap documentation examples

## Changes
- **`.keys()`**
- **`.values()`**
- **`.values_mut()`**
- **`.iter()`**
- **`.iter_mut()`**
2026-05-18 17:07:11 +02:00
Jonathan Brouwer a6138ec142 Rollup merge of #156444 - ChrisDenton:os_str_split_at, r=nia-e
Implement `OsStr::split_at`

See rust-lang/rust#156199

This allows splitting only on valid UTF-8 boundaries, regardless of the platform, which avoids cross-platform landmines.
2026-05-18 17:07:05 +02:00
Jacob Pratt 3008421df2 Rollup merge of #156702 - emilyalbini:ea-qyuqlszrnltt, r=noratrieb
Update list of platforms vulnerable to TOCTOU in `remove_dir_all`

Neither platform can reasonably protect against TOCTOU in `remove_dir_all`:

* VxWorks doesn't always have the required API (depending on how it's built), and its security model prevents untrusted processes from existing.
* QNX itself is broken and prevents the use of `openat()`: in QNX 7.1, `O_NOFOLLOW` is straight up ignored, and in QNX 8.0 `openat()` works *but* there is a TOCTOU in the kernel itself.
2026-05-18 13:52:59 +02:00
Emily Albini 23a860e713 update list of platforms vulnerable to TOCTOU 2026-05-18 11:34:48 +02:00
JafarTano 7905c8fd99 Add diagnostic items for IoBufReader and StdinLock 2026-05-18 11:14:17 +03:00
Josh Triplett 1c1aceb139 Add doc alias atty for is_terminal 2026-05-18 08:30:45 +02:00
Josh Triplett c3c12151e2 Add doc alias filetime for File::set_times 2026-05-18 08:30:33 +02:00
Josh Triplett 6780791cda Add doc alias home for home_dir 2026-05-18 08:30:21 +02:00
Jonathan Brouwer 3810819af3 Rollup merge of #156677 - Cheese-Space:main, r=SimonSapin
change `other uses of const` to `raw pointers` in const keyword docs

this section only talks about how `const` is used in raw pointers and doesn't give any other uses, so in my opinion it would be a bit clearer if the section was named `raw pointers` or something similar.
2026-05-18 03:19:51 +02:00
Jonathan Brouwer 0104cf008e Rollup merge of #156638 - FelixLttks:fix-espidf-sigkill, r=SimonSapin
library: Fix std compilation for espidf target in unix::process

Fixes a regression on the riscv32imac-esp-espidf target caused by commit 7bf5fe7bf8 (linked issue rust-lang/rust#156537) . The unix_kill_process_group feature attempts to use libc::SIGKILL, which is not supported on the espidf target.

Discussed in `esp-idf-sys` issue: https://github.com/esp-rs/esp-idf-sys/issues/419
2026-05-18 03:19:49 +02:00
Jonathan Brouwer a99602d456 Rollup merge of #156572 - xtqqczze:sound-env, r=SimonSapin
std: replace "safe" with "sound" in safety documentation

- `env::set_var`
- `env::remove_var`

Context: https://github.com/rust-lang/rust/pull/124636
2026-05-18 03:19:47 +02:00
Jonathan Brouwer 05e9620f33 Rollup merge of #156492 - RalfJung:cfg-miri, r=SimonSapin
remove/update various cfg(miri)

I went over all `cfg(miri)` in `library/`. Most of the things I noticed have become separate PRs; these here are the few remaining scattered little fixes in various places.
2026-05-18 03:19:44 +02:00
Cheese_space 76955f4f2d change other uses of const to raw pointers 2026-05-17 22:52:56 +02:00
FelixLttks 88eb204a7a Fix compilation for espidf target by conditionally disabling process group killing 2026-05-16 12:18:45 +02:00
Bowluckie 3e3baaf15e removed extra space after ///
at lines 495 and 558
2026-05-16 12:38:21 +10:00
Bowluckie 760b3f40bf fixed some bugs in hashmap documentation comments
`.keys()` was using `.values()` in the comment and 2 other functions were missing `use std::collections::HashMap`
2026-05-16 11:35:43 +10:00
Bowluckie 20f68aebb1 Updated map.rs functions to all use asserts instread of println! in documentations
Updated `.keys()`, `.values()`, `.iter()` and `.iter_mut()`. 

Instead of using print statements which shows no clear effect  by just reading the documentation
2026-05-16 11:04:33 +10:00
Bowluckie 4950a3c1a2 updated map.rs .values() method to use assert instead of println! 2026-05-16 10:35:30 +10:00
Jonathan Brouwer ae98f76b1c Rollup merge of #156493 - RalfJung:run-temp-dir, r=ChrisDenton
actually run the temp_dir doctest

No idea why this currently doesn't get run.

That said, this might fail in Miri, so we may have to wait for https://github.com/rust-lang/miri/pull/5029.
2026-05-15 20:11:45 +02:00
bors 88ba7fbe0a Auto merge of #155360 - malezjaa:try_insert_changes, r=cuviper
map_try_insert changes





Made changes according to https://github.com/rust-lang/rust/issues/82766#issuecomment-4253028464.

r? @tgross35
2026-05-15 08:12:52 +00:00
Ralf Jung 9faff71e46 actually run the temp_dir doctest 2026-05-14 23:12:46 +02:00
malezjaa ca70543ca4 map_try_insert changes 2026-05-14 22:36:03 +02:00
xtqqczze 181845e3fc std: replace "safe" with "sound" in safety documentation 2026-05-14 13:43:33 +01:00
Chris Denton 921b35bb6d Implement OsStr::split_at 2026-05-14 06:08:58 +00:00
John Millikin 7bf5fe7bf8 Add ChildExt::kill_process_group
This function wraps POSIX `killpg(pid, SIGKILL)`, and on Linux
additionally may be implemented by `pidfd_send_signal`.
2026-05-13 22:39:57 +09:00
John Millikin 2c30279ff6 Add send_process_group_signal to existing unix_send_signal feature
This function wraps POSIX `killpg()`, and on Linux additionally
may be implemented by `pidfd_send_signal`.
2026-05-13 19:41:14 +09:00
Jonathan Brouwer ac656cbf21 Rollup merge of #156431 - bushrat011899:core_io_util, r=nia-e
Move `std::io::util` to `core::io`

ACP: https://github.com/rust-lang/libs-team/issues/755
Tracking issue: https://github.com/rust-lang/rust/issues/154046
Subset of: https://github.com/rust-lang/rust/pull/154684

## Description

Moves utility types and functions from `std::io::util` and `std::io` to `core::io`, leaving any IO trait implementations behind. They will be moved along with the traits themselves. Certain documentation links had to be amended.

- `Chain`
- `Empty`
- `Repeat`
- `Sink`
- `Take`
- `empty`
- `repeat`
- `sink`

---

## Notes

* This can be reviewed independently of the other PRs tracked in rust-lang/rust#154046.
* `Chain` and `Take` were previously in the main `mod.rs` file for `std::io`, but I've chosen to move them into the `util.rs` file in `core::io` instead. I think they make more sense in that file, but I'm happy to move them into `mod.rs` if that's a controversial decision.
* No AI tooling of any kind was used during the creation of this PR.
2026-05-12 18:53:37 +02:00
Jonathan Brouwer 5a38b67a02 Rollup merge of #156428 - bushrat011899:core_io_cursor, r=nia-e
Move `std::io::Cursor` to `core::io`

ACP: https://github.com/rust-lang/libs-team/issues/755
Tracking issue: https://github.com/rust-lang/rust/issues/154046
Subset of: https://github.com/rust-lang/rust/pull/154684

## Description

Moves `std::io::Cursor` to `core::io`, leaving the IO trait implementations behind. They will be moved along with the traits themselves. Certain documentation links had to be amended, and a private/unstable `into_parts_mut` method was added to allow the internals to remain private.

---

## Notes

* This can be reviewed independently of the other PRs tracked in rust-lang/rust#154046.
* No AI tooling of any kind was used during the creation of this PR.
2026-05-12 18:53:36 +02:00
Zac Harrold 5cbf9f8c8b Move std::io::util to core::io 2026-05-12 23:07:34 +10:00
Zac Harrold e9125c62b1 Move std::io::Cursor into core::io 2026-05-12 22:59:37 +10:00
Ralf Jung 4625f8ccbd remove/update various cfg(miri) 2026-05-12 09:50:48 +02:00
Jonathan Brouwer 8cfae220da Rollup merge of #156393 - RalfJung:core-miri-tests, r=tgross35
enable more f16/f128 tests in Miri

See the individual commit messages for details.

The last commit is a drive-by comment fix that was not worth its own PR.
r? @tgross35
2026-05-12 07:03:55 +02:00
Ralf Jung d6df0b0b57 enable f16/f128 doctests in Miri 2026-05-11 22:42:46 +02:00
Jonathan Brouwer bd479badfb Rollup merge of #156392 - Wilfred:float_ceil_docs, r=Mark-Simulacrum
Improve doc comments for f32::ceil() and f32::floor()

Previously ::floor() included an example showing behaviour for negative values, but ::ceil() did not. Ensure both have examples of the negative case, for both f32 and f64.

Whilst we're here, tweak the wording slightly so it reads better.
2026-05-11 10:29:20 +02:00
Jonathan Brouwer 4f22db3e86 Rollup merge of #156375 - RalfJung:kernel_copy-background-threads, r=Mark-Simulacrum
kernel_copy tests: properly join background threads

This helps Miri because when there are threads just hanging in the background, we cannot check for memory leaks.

I think even without Miri this currently leads to 100% CPU load on one core for each of these threads: once the test function returns and `sink` gets dropped, the `read` in the thread will always immediately return `0`, and then we just loop with that forever until the process exits.
2026-05-11 10:29:16 +02:00
Jonathan Brouwer 5e230f5de6 Rollup merge of #156389 - RalfJung:miri-fs, r=Mark-Simulacrum
prepare fs tests for miri

- reduce iteration counts to get rid of timeouts
- disable one test that relies on spawning processes
2026-05-11 10:29:14 +02:00
Jonathan Brouwer dd38e55468 Rollup merge of #156387 - RalfJung:fs-error-str, r=ChrisDenton
std fs tests: avoid matching on OS-provided error string

These tests are [ancient](https://github.com/rust-lang/rust/commit/6bfbad937bdf578e35777d079f8dcfab49758041). No idea why there written in this style back then, but today we'd clearly check the `ErrorKind`, not the string.

r? @ChrisDenton
2026-05-10 19:05:45 +02:00
Wilfred Hughes e8eb80b9de Improve doc comments for f32::ceil() and f32::floor()
Previously ::floor() included an example showing behaviour for
negative values, but ::ceil() did not. Ensure both have examples of
the negative case, for both f32 and f64.

Whilst we're here, tweak the wording slightly so it reads better.
2026-05-10 12:25:39 +01:00
Ralf Jung 5901bb8d2d remove some miri test gates 2026-05-10 12:45:15 +02:00
Ralf Jung d1c3e91a7e prepare fs tests for miri 2026-05-10 12:03:47 +02:00
Ralf Jung a0298aa7e5 std fs tests: avoid matching on OS-provided error string 2026-05-10 11:34:21 +02:00
Matthias Krüger 34018578e2 Rollup merge of #156133 - RalfJung:time-panic-track-caller, r=Mark-Simulacrum
mark some panicking methods around Duration as track_caller

Currently when they panic it looks like this
```
  0.005045   ---- instant_checked_duration_since_nopanic stdout ----
  0.000039
  0.000009   thread 'instant_checked_duration_since_nopanic' (2) panicked at /home/runner/work/miri-test-libstd/miri-test-libstd/rust-src-patched/library/std/src/time.rs:445:33:
  0.000007   overflow when subtracting duration from instant
  0.000006   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  0.000007   note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
```
That's pretty useless.

Also fix the panic message while we are at it.
2026-05-10 03:17:03 +02:00
Matthias Krüger 6fffff97dd Rollup merge of #156107 - Cheese-Space:patch-1, r=Mark-Simulacrum
remove turbofish notation + use None / Some instead of Option:: (in match documentation)
2026-05-10 03:17:03 +02:00
Matthias Krüger 9165dbf12f Rollup merge of #155970 - tomilepp:issue-155968-fix, r=joshtriplett
Add mention of sendfile(2) and splice(2) to fs::copy() documentation.

Fixes rust-lang/rust#155968 by adding mention of sendfile(2) and splice(2) from io::copy()
2026-05-10 03:16:58 +02:00
Matthias Krüger 17977f330e Rollup merge of #149362 - schneems:schneems/get_resolved_envs, r=Mark-Simulacrum
Add Command::get_resolved_envs

This addition allows an end-user to inspect the environment variables that are visible to the process when it boots.

Discussed in:

- Tracking issue: https://github.com/rust-lang/rust/issues/149070 (partially closes)
- ACP: https://github.com/rust-lang/libs-team/issues/194
2026-05-10 03:16:57 +02:00
Ralf Jung e35d0affe7 kernel_copy tests: properly join background threads 2026-05-09 23:31:18 +02:00
bors 82bee96507 Auto merge of #155321 - briansmith:b/bufwriter-conservative, r=Mark-Simulacrum
`BufWriter`: Make the soundness of `BorrowedBuf` usage clearer.

The previous safety comment was outdated as it was written before `BorrowedBuf::set_init` was changed to be a boolean. It also failed to address the possibility that `flush_buf` invalidated the assumption.
2026-05-09 18:40:20 +00:00
Tomi Leppikangas f4adc40bbe Add mention of sendfile(2) and splice(2) to fs::copy() documentation.
* Add mention of sendfile(2) and splice(2) to fs::copy() documentation.
* Oxford comma fix
2026-05-09 17:43:33 +00:00