Commit Graph

9185 Commits

Author SHA1 Message Date
Wildan M 1f02e4d1df std: Fix thread::available_parallelism on Redox targets 2026-05-27 07:39:24 +07:00
bors d1fc603d17 Auto merge of #156385 - RalfJung:tcp-ports, r=nia-e
std::net::tcp: let the OS pick the port numbers



See rust-lang/rust#156377 for context.
I only did the TCP tests for now to see whether there are any unexpected problems.
2026-05-26 19:36:32 +00:00
Jonathan Brouwer d8a003a6d9 Rollup merge of #156761 - kcx1:fix/156730, r=tgross35
tidy: remove duplicate entry and alphabetize OS constants list
2026-05-26 13:42:17 +02:00
Pieter-Louis Schoeman 9b3cd578ab Remove provisional Share trait FIXME notes 2026-05-22 07:13:06 +02:00
Pieter-Louis Schoeman 4a32c28276 Add Share impl for mpsc SyncSender 2026-05-22 00:16:29 +02:00
Pieter-Louis Schoeman 4b32cb2b00 Add Share impl for mpsc Sender 2026-05-22 00:14:24 +02:00
Jonathan Brouwer 8162cf582b Rollup merge of #156242 - Jamesbarford:feat/remove-alwaysinline+target-feature, r=RalfJung,saethlin
Remove unsound `target_feature_inline_always` feature

## Summary
- Remove `target_feature_inline_always`
- Update stdarch generators to only use `#[inline]` & regenerate stdarch.

## Why?
Succinctly; the feature relies on LLVMs `AlwaysInlinerPass()` running before LLVMs heuristic based inliner pass. Which is not a basis for sound code.

This has been discussed in [the tracking issue](https://github.com/rust-lang/rust/issues/145574).

If the ordering of the passes were to change, of which they have in the past, it is very possible we could inline functions across callsites with mismatching target features leading to unsound code. Checks proposed in; https://github.com/rust-lang/rust/pull/155426 would only take into account caller -> callee which is not enough to guard against possibly of generating unsound code if the pass ordering were to change.

There doesn't seem to be a way, presently, this this mechanism to provide soundness guarantees nor does it seem like `AlwaysInlinerPass()` is a desired feature of LLVM, which this feature relies on.

r? @RalfJung
2026-05-21 12:21:45 +02:00
bors 4b9792692f Auto merge of #156589 - cuviper:revert-dbg-tearing, r=the8472
Revert tearing changes to `dbg!`

Since the primary change to `dbg!` in rust-lang/rust#149869, we've been chasing a few regressions:

* rust-lang/rust#153850, fixed by rust-lang/rust#154074
* rust-lang/rust#154988, fixed by rust-lang/rust#154994
* rust-lang/rust#155902, proposed fix in rust-lang/rust#155915

We already reverted this once, on beta only to prevent these regressions from shipping in 1.95.

In that most recent PR, we decided that it would be better to revert `dbg!` to its original state everywhere (`main` and 1.96-`beta`), and then we can consider it from scratch later. So here I've reverted the change and its fixes, but kept the regression tests, including the pending one.

cc @joboet @dianne @rust-lang/libs 
@rustbot label beta-nominated
2026-05-19 23:24:13 +00:00
kcx1 16b12e39f3 tidy: alphabetize os constants list 2026-05-19 18:00:32 -04:00
kcx1 fcb580ca5f docs: remove duplicate "hermit" entry in OS constants list 2026-05-19 17:59:39 -04:00
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
Josh Stone 6f35b83469 Restore dbg! regression tests
These are all tests from trying to fix the tear-free `dbg!`:

* rust-lang/rust#154074
* rust-lang/rust#154994
* rust-lang/rust#155915

These should also work as we revert to the old `dbg!`, so we should keep
the tests to make sure they don't regress again.

Co-authored-by: dianne <diannes.gm@gmail.com>
2026-05-14 16:39:43 -07:00
Josh Stone 9246e19299 Revert "Rollup merge of #149869 - joboet:torn-dbg, r=Mark-Simulacrum"
This reverts commit cc666ba8f4, reversing
changes made to 2da5959600.
2026-05-14 16:08:56 -07:00
Josh Stone c9d9448c98 Revert "Rollup merge of #154074 - dianne:dbg-temp-scopes, r=Mark-Simulacrum"
This reverts commit 2a18b885ce, reversing
changes made to cd14b73b4a.
2026-05-14 15:37:07 -07:00
Josh Stone 73931c4422 Revert "Rollup merge of #154994 - dianne:no-dbg-temp, r=Mark-Simulacrum"
This reverts commit 59b36a5283, reversing
changes made to 197eb8c6c0.
2026-05-14 15:36:33 -07: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
Ralf Jung da87ea7514 std::net::tcp: let the OS pick the port numbers 2026-05-12 20:38:12 +02: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