Commit Graph

28509 Commits

Author SHA1 Message Date
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
Jonathan Brouwer 022bff2ead Rollup merge of #156479 - ast-ral:dev-missing-space-decrement-strong-count, r=camelid
fix missing space in Rc::decrement_strong_count docs
2026-05-12 07:03:56 +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
ast-ral ed2f960d5b fix missing space in Rc::decrement_strong_count 2026-05-11 17:09:34 -07:00
Jonathan Brouwer 9d01eaad2e Rollup merge of #156442 - Flakebi:gpu-docs, r=RalfJung
Show intrinsics::gpu in docs

It was previously not visible (unless compiling docs for amdgpu, which I guess nobody does).
Follow other specific intrinsics and always include them in docs.

Now looks like this:
<img width="1220" height="446" alt="2026-05-11_10-51-05" src="https://github.com/user-attachments/assets/c3a98f0e-2803-4697-87a8-1cc8ff01815c" />

r? @ZuseZ4 (I hope you are fine with reviewing this, please re-assign if not :))
2026-05-11 23:03:08 +02:00
Ralf Jung d7ddcc4bfa update cfg(miri)-related comments 2026-05-11 22:42:47 +02:00
Ralf Jung 8cecc34491 re-enable checked_ilog2 test in Miri 2026-05-11 22:42:47 +02:00
Ralf Jung a010e882bc Set target_has_reliable_* to reasonable values in Miri, and update coretests logic 2026-05-11 22:42:46 +02:00
Ralf Jung d6df0b0b57 enable f16/f128 doctests in Miri 2026-05-11 22:42:46 +02:00
Flakebi 2af21c3f0d Show intrinsics::gpu in docs
It was previously not visible (unless compiling docs for amdgpu, which
I guess nobody does).
Follow other specific intrinsics and always include them in docs.
2026-05-11 10:39:58 +02:00
Jonathan Brouwer 33670e20c4 Rollup merge of #156426 - GuillaumeGomez:fix-cfg-display-integers, r=Urgau
Fix unwanted "Available on XX-bit only" in libcore integers

Fixes rust-lang/rust#149786.

The problem came from:

<img width="754" height="734" alt="image" src="https://github.com/user-attachments/assets/c251326f-8640-420d-bc4c-a3246390ea67" />

The `doc_cfg` feature picks the `cfg` as it should. If we don't want it, we simply need to disable the feature on it. With this fix, no more `cfg` annotations:

<img width="860" height="590" alt="image" src="https://github.com/user-attachments/assets/da793590-bf43-4874-94e1-a56809938420" />

r? @Urgau
2026-05-11 10:29:22 +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 b7c916246b Rollup merge of #156357 - RalfJung:slow-test, r=Mark-Simulacrum
tests: ip*_properties: avoid parsing the IP over and over again

This test somehow takes 12s to execute in Miri (on CI, i.e. on a slow machine), despite not having any loop. I suspect it's caused by us for some reason re-parsing the same string again and again. Let's just not do that.
2026-05-11 10:29:13 +02:00
bors 8afb6a8b1b Auto merge of #153975 - cyrgani:remove-f64-methods, r=scottmcm
remove forever-deprecated and hidden `f64` methods



The methods `f64::is_positive` and `f64::is_negative` were deprecated since 1.0 and marked as `#[doc(hidden)]` in favor of `f64::is_sign_positive` and `f64::is_sign_negative`. They also only exist on `f64`, not on `f32`. But for some unknown reason, they have been marked as stable.

This PR proposes to remove both methods as they were never a part of the documented API, assuming that a crater run finds no significant breakage.
2026-05-11 03:22:11 +00:00
Guillaume Gomez 5a52e12664 Fix unwanted "Available on XX-bit only" 2026-05-11 03:31:13 +02:00
bors 4b0c9d76ae Auto merge of #156405 - JonathanBrouwer:rollup-yJcad1j, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#156394 (miri subtree update)
 - rust-lang/rust#154972 (Implement `core::arch::return_address` and tests)
 - rust-lang/rust#155679 (rustdoc: Reify emission types)
 - rust-lang/rust#155982 (Fix closure HIR span context mismatch)
 - rust-lang/rust#156323 (Handle --print=backend-has-mnemonic in cg_clif)
 - rust-lang/rust#156387 (std fs tests: avoid matching on OS-provided error string)
 - rust-lang/rust#156129 (compiletest: Migrate from `PassMode`/`FailMode` to `PassFailMode`)
 - rust-lang/rust#156192 (core: Replace `ptr::slice_from_raw_parts` with `slice::from_raw_parts`)
 - rust-lang/rust#156365 (stream_send_recv_stress tests: wait for threads to finish)
 - rust-lang/rust#156368 (Fix invalid unreachable in is_known_valid_scrutinee for Reborrow)
2026-05-10 19:58:51 +00:00
Jonathan Brouwer 4d2f9ca08d Rollup merge of #156365 - RalfJung:stream_send_recv_stress, r=nia-e
stream_send_recv_stress tests: wait for threads to finish

These tests currently fail in Miri (when run with nextest) because all they do is spawn a lot of threads that will do stuff, but they don't wait for the threads to actually finish. Miri by default errors when there are background threads lingering when `main` is done (since that can indicate a leak, and since it makes it impossible to check for memory leaks). Miri gives background threads a bit of time to finish when `main` is done, but for these tests that's nowhere near enough since basically the entire test runs after `main` is done.

Outside Miri, this could also still mean that the test doesn't actually run to completion, it might get abort when `main` finishes.

So let's use `thread::scope` to ensure all threads are done before the test is considered done.
2026-05-10 19:05:47 +02:00
Jonathan Brouwer 06ccbc1929 Rollup merge of #156192 - xtqqczze:slice-from-raw-parts, r=Mark-Simulacrum
core: Replace `ptr::slice_from_raw_parts` with `slice::from_raw_parts`
2026-05-10 19:05:47 +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
Jonathan Brouwer 30ec142b97 Rollup merge of #154972 - chorman0773:return_address, r=Mark-Simulacrum
Implement `core::arch::return_address` and tests

Tracking issue: rust-lang/rust#154966

Implements libs-team#768
2026-05-10 19:05:42 +02:00
bors e8f92f5769 Auto merge of #144537 - frank-king:feature/pin-drop, r=petrochenkov
Add `Drop::pin_drop` for pinned drops





This PR is part of the `pin_ergonomics` experiment (the tracking issue is rust-lang/rust#130494). It allows implementing `Drop` with a pinned `self` receiver, which is required for safe pin-projection.

Implementations:
- [x] At least and at most one of `drop` and `pin_drop` should be implemented.
- [x] No direct call of `drop` or `pin_drop`. They should only be called by the drop glue.
- [x] `pin_drop` must and must only be used with types that support pin-projection (i.e. types with `#[pin_v2]`).
- [ ] Allows writing `fn drop(&pin mut self)` and desugars to `fn pin_drop(&pin mut self)`. (Will be in the next PRs)
2026-05-10 16:43:01 +00: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 27282040f7 Rollup merge of #155705 - Jules-Bertholet:word-to-titlecase, r=Mark-Simulacrum
Add `str::word_to_titlecase()` to `alloc`

A small addition to https://github.com/rust-lang/rust/issues/153892.

Hasn't gone through ACP, so needs libs-API signoff.

@rustbot label A-Unicode T-libs-api
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
Jules Bertholet 40da877450 Add str::word_to_titlecase() to alloc
* Add `str::word_to_titlecase()` to `alloc`
* Address review comment
2026-05-09 17:42:42 +00:00
Ralf Jung 773af23505 stream_send_recv_stress tests: wait for threads to finish 2026-05-09 17:37:09 +02:00
Jacob Pratt 2976a2ceab Rollup merge of #156359 - folkertdev:to-from-be-le-cfg-select, r=chenyukang
use `cfg_select!` in integer `{to, from}_{le, be}`

A simple bit of cleanup.
2026-05-09 09:27:57 -04:00
Folkert de Vries 6c799065a4 use cfg_select! in {to, from}_{le, be} 2026-05-09 14:37:33 +02:00
Ralf Jung 862f88747a tests: ipv6_properties: avoid parsing the IP over and over again 2026-05-09 14:31:40 +02:00
Frank King 334ed47d07 Add Drop::pin_drop for structually pinned types 2026-05-09 19:10:18 +08:00
lms0806 5d7f9b5755 chore : remove not stable explain and edit code explain 2026-05-09 17:51:24 +09:00
Josh Triplett 024032e66b Rename the unstable integer extend function to widen
This is consistent with our use of `widening` elsewhere.

Suggested-by: Gabriel Bjørnager Jensen <gabriel@achernar.io>
2026-05-07 22:44:22 -07:00
Jonathan Brouwer 92dbb8a02b Rollup merge of #152487 - joboet:array_map_zst, r=oli-obk
core: drop unmapped ZSTs in array `map`

Fixes https://github.com/rust-lang/rust/issues/152211.
Alternative to rust-lang/rust#152220 and rust-lang/rust#152248.

This makes the `Drain` type use the same ZST-handling strategy as `slice::IterMut`, which stores the remaining length instead of a one-past-the-end pointer when the type is a ZST. I've also removed the const-generic `N` parameter from `Drain` to avoid unnecessary monomorphizations.
2026-05-07 22:44:05 +02:00
Jonathan Brouwer 96e4153100 Rollup merge of #151753 - aapoalas:aapoalas/reborrow-and-coerce-shared-first-version, r=oli-obk
Experiment: Reborrow traits

With this PR we now have basic functional Reborrow and CoerceShared traits. The current limitations are:

1. Reborrowable types can only have one lifetime parameter, so as to avoid having to figure out and store in rmeta the information of which lifetimes weaken during reborrowing.
2. Reborrowing of `&mut` wrappers is working (though I've not tested generic wrappers like `Option<&mut T>` yet), but CoerceShared of `&mut` wrappers currently causes an ICE.

The remaining tasks to complete before I'd consider this PR mergeable are:

- [x] Fix ICE on CoerceShared. Unfortunately this might require dipping into rmeta.
- [x] Expand the tests to give a more complete view of the current state of the experiment.

Reborrow traits experiment: rust-lang/rust#145612

Co-authored by @dingxiangfei2009
2026-05-07 22:44:03 +02:00