Skip to content

Conversation

@github-actions
Copy link

This is an automated PR to merge library subtree updates from 2025-07-10 (rust-lang/rust@e43d139) to 2025-07-14 (rust-lang/rust@e9182f1), inclusive. This is a clean merge, no conflicts were detected. Do not remove or edit the following annotations:
git-subtree-dir: library
git-subtree-split: 9d16539

bjorn3 and others added 30 commits June 20, 2025 12:14
The panic_abort crate must be compiled with panic=abort, but cargo
doesn't allow setting the panic strategy for a single crate the usual
way using panic="abort", but luckily per-package rustflags do allow
this. Bootstrap previously handled this in its rustc wrapper, but for
example the build systems of cg_clif and cg_gcc don't use the rustc
wrapper, so they would either need to add one, patch the standard
library or be unable to build a sysroot suitable for both panic=abort
and panic=unwind (as is currently the case).
Added it to the reexported, which is intended
rustdoc behavior, but is apparently untested,
so I also added a test for it.
Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.

Implements `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types, which remove at most one occurrence of a prefix/suffix while always returning a string/slice (rather than Option), enabling easy method chaining.

## Tracking issue
rust-lang#142312

## API
```rust
impl str {
    pub fn trim_prefix<P: Pattern>(&self, prefix: P) -> &str;
    pub fn trim_suffix<P: Pattern>(&self, suffix: P) -> &str
    where
        for<'a> P::Searcher<'a>: ReverseSearcher<'a>;
}

impl<T> [T] {
    pub fn trim_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> &[T]
    where
        T: PartialEq;
    pub fn trim_suffix<P: SlicePattern<Item = T> + ?Sized>(&self, suffix: &P) -> &[T]
    where
        T: PartialEq;
}
```

## Examples
```rust
// Method chaining
assert_eq!(" <https://example.com/> ".trim().trim_prefix('<').trim_suffix('>').trim(), "https://example.com/");

// Slices
let v = &[10, 40, 30];
assert_eq!(v.trim_prefix(&[10]), &[40, 30][..]);
```

## ACP
Originally proposed in rust-lang/libs-team#597
…ingjubilee

Convert `ilog(10)` to `ilog10()`

Except in tests, convert `integer.ilog(10)` to `integer.ilog10()` for better speed and to provide better examples of code that efficiently counts decimal digits. I couldn't find any instances of `integer.ilog(2)`.
"Basic usage" implies there is an example that shows advanced usage,
but these APIs are extra simple.
Rollup of 9 pull requests

Successful merges:

 - rust-lang#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.)
 - rust-lang#142491 (Rework #[cold] attribute parser)
 - rust-lang#142494 (Fix missing docs in `rustc_attr_parsing`)
 - rust-lang#142495 (Better template for `#[repr]` attributes)
 - rust-lang#142497 (Fix random failure when JS code is executed when the whole file was not read yet)
 - rust-lang#142575 (Ensure copy* intrinsics also perform the static self-init checks)
 - rust-lang#142650 (Refactor Translator)
 - rust-lang#142713 (mbe: Refactor transcription)
 - rust-lang#142755 (rustdoc: Remove `FormatRenderer::cache`)

r? `@ghost`
`@rustbot` modify labels: rollup
…tern, r=petrochenkov

Marks ADT live if it appears in pattern

Marks ADT live if it appears in pattern, it implies the construction of the ADT.
1. Then we can detect unused private ADTs impl `Default`, without special logics for `Default` and other std traits.
2. We can also remove `rustc_trivial_field_reads` on `Default`, and the logic in `should_ignore_item` (introduced by rust-lang#126302).

Fixes rust-lang#120770

Extracted from rust-lang#128637.
r? `@petrochenkov`
…oli-obk

Make `Clone` a `const_trait`

See [tracking issue](rust-lang#142757) for justification.
…y, r=Manishearth,Urgau

Add diagnostic items for Clippy

Clippy still uses some paths to access items from the standard library. Adding the missing diagnostic items allows removing the last remaining paths.

Closes rust-lang/rust-clippy#5393
… r=tgross35

add doc(alias("AsciiChar")) to core::ascii::Char

Added it to the reexported, which is intended rustdoc behavior, but is apparently untested, so I also added a test for it.
…petrochenkov

Pass -Cpanic=abort for the panic_abort crate

The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate the usual way using `panic="abort"`, but luckily per-package rustflags do allow this. Bootstrap previously handled this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use the rustc wrapper, so they would either need to add one, patch the standard library or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case).

Required for rust-lang/rustc_codegen_cranelift#1567
…crum

integer docs: remove extraneous text

"Basic usage" implies there is an example that shows advanced usage, but these APIs are extra simple.
Add DesugaringKind::FormatLiteral

Implements `DesugaringKind::FormatLiteral` to mark the FormatArgs desugaring of format literals. The main use for this is to stop yapping about about formatting parameters if we're not anywhere near a format literal. The other use case is to fix suggestions such as rust-lang#141350. It might also be useful for new or existing diagnostics that check whether they're in a format-like macro.

cc `@xizheyin` `@fmease`
This shouldn't have worked originally, as far as we can tell.
Let String pass #[track_caller] to its Vec calls

I've added `#[track_caller]` to `String` methods that delegate to `Vec` methods that already have `#[track_caller]`.

I've also added `#[track_caller]` to methods that have `assert!` or `panic!` due to invalid inputs.
Change `core::iter::Fuse`'s `Default` impl to do what its docs say it does

The [docs on `impl<I: Default> Default for core::iter::Fuse<I>`](https://doc.rust-lang.org/nightly/std/iter/struct.Fuse.html#impl-Default-for-Fuse%3CI%3E) say (as the `I: Default` bound implies) that `Fuse::<I>::default` "Creates a `Fuse` iterator from the default value of `I`". However, the implementation creates a `Fuse` with `Fuse { iter: Default::default() }`, and since the `iter` field is an `Option<I>`, this is actually `Fuse { iter: None }`, not `Fuse { iter: Some(I::default()) }`, so `Fuse::<I>::default()` always returns an empty iterator, even if `I::default()` would not be empty.

This PR changes `Fuse`'s `Default` implementation to match the documentation. This will be a behavior change for anyone currently using `Fuse::<I>::default()` where `I::default()` is not an empty iterator[^1], as `Fuse::<I>::default()` will now also not be an empty iterator.

(Alternately, the docs could be updated to reflect what the current implementation actually does, i.e. returns an always-exhausted iterator that never yields any items (even if `I::default()` would have yielded items). With this option, the `I: Default` bound could also be removed to reflect that no `I` is ever created.)

[Current behavior example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=a1e0adc4badca3dc11bfb70a99213249) (maybe an example like this should be added to the docs either way?)

This PR changes publicly observable behavior, so I think requires at least a T-libs-api FCP?

r? libs-api

cc rust-lang#140961

`impl<I: Default> Default for Fuse<I>` was added in 1.70.0 (rust-lang#99929), and it's docs and behavior do not appear to have changed since (`Fuse`'s `iter` field has been an `Option` since before the impl was added).

[^1]: IIUC it is a "de facto" guideline for the stdlib that an iterator type's `default()` should be empty (and for iterators where that would not make sense, they should not implement `Default`): cc rust-lang/libs-team#77 (comment) , so for stdlib iterators, I don't think this would change anything. However, if a user has a custom `Iterator` type `I`, *and* they are using `Fuse<I>`, *and* they call `Fuse::<I>::default()`, this may change the behavior of their code.
…boet

std: sys: random: uefi: Provide rdrand based fallback

Some UEFI systems based on American Megatrends Inc. v3.3 do not provide RNG support [1]. So fallback to rdrand in such cases.

[1]: rust-lang#138252 (comment)

Fixes rust-lang#138252

cc `@seijikun`
Add note about `str::split` handling of no matches.

Adds small note and example to the test for a non matching pattern

resolves rust-lang#142734
phantom_variance_markers: fix identifier usage in macro

This shouldn't have worked originally, as far as we can tell.
Fixes an implementation detail of rust-lang#135806.
In [137653], the lang and libs-API teams did a joint FCP to deprecate
and eventually remove the long-unstable `concat_idents!` macro. The
deprecation is landing in 1.88, so do the removal here (target version
1.90).

This macro has been superseded by the more recent `${concat(...)}`
metavariable expression language feature, which avoids some of the
limitations of `concat_idents!`. The metavar expression is unstably
available under the [`macro_metavar_expr_concat`] feature.

History is mildly interesting here: `concat_idents!` goes back to 2011
when it was introduced with 513276e ("Add #concat_idents[] and
about the same:

    let asdf_fdsa = "<.<";
    assert(#concat_idents[asd,f_f,dsa] == "<.<");

    assert(#ident_to_str[use_mention_distinction]
           == "use_mention_distinction");

(That test existed from introduction until its removal here.)

Closes: https://www.github.com/rust-lang/rust/issues/29599

[137653]: https://www.github.com/rust-lang/rust/pull/137653
[`macro_metavar_expr_concat`]: https://www.github.com/rust-lang/rust/issues/124225
…anieu

Allow comparisons between `CStr`, `CString`, and `Cow<CStr>`.

Closes: rust-lang#137265

This PR adds the trait implementations proposed in the [ACP](rust-lang/libs-team#517) under the `c_string_eq_c_str` feature gate:

```rust
// core::ffi

impl PartialEq<&Self> for CStr;

impl PartialEq<CString> for CStr;

impl PartialEq<Cow<'_, Self>> for CStr;

// alloc::ffi

impl PartialEq<CStr> for CString;

impl PartialEq<&CStr> for CString;

impl PartialEq<Cow<'_, CStr>> for CString;

// alloc::borrow

impl PartialEq<CStr> for Cow<'_, CStr>;

impl PartialEq<&CStr> for Cow<'_, CStr>;

impl PartialEq<CString> for Cow<'_, CStr>;
```

As I understand it, stable traits cannot be unstably implemented for stable types, and we would thereby be forced to skip the FCP and directly stabilise these implementations (as is done in this PR).

(`@joshtriplett` mentioned that Crater may have to be run).
okaneco and others added 12 commits July 11, 2025 14:41
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - rust-lang#143302 (`tests/ui`: A New Order [27/N])
 - rust-lang#143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - rust-lang#143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - rust-lang#143611 (Mention more APIs in `ParseIntError` docs)
 - rust-lang#143661 (chore: Improve how the other suggestions message gets rendered)
 - rust-lang#143708 (fix: Include frontmatter in -Zunpretty output )
 - rust-lang#143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: i686-gnu-nopt-1
try-job: test-various
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#143403 (Port several trait/coherence-related attributes the new attribute system)
 - rust-lang#143633 (fix: correct assertion to check for 'noinline' attribute presence before removal)
 - rust-lang#143647 (Clarify and expand documentation for std::sys_common dependency structure)
 - rust-lang#143716 (compiler: doc/comment some codegen-for-functions interfaces)
 - rust-lang#143747 (Add target maintainer information for aarch64-unknown-linux-musl)
 - rust-lang#143759 (Fix typos in function names in the `target_feature` test)
 - rust-lang#143767 (Bump `src/tools/x` to Edition 2024 and some cleanups)
 - rust-lang#143769 (Remove support for SwitchInt edge effects in backward dataflow)
 - rust-lang#143770 (build-helper: clippy fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
std: move NuttX to use arc4random for random number generation

arc4random support in libc merged in rust-lang/libc#4464, so:

* Move `target_os = "nuttx"` from unix_legacy to arc4random section
* This aligns NuttX with other POSIX-compliant systems that support arc4random
* Improves random number generation quality on NuttX by using the system's built-in arc4random implementation instead of legacy fallback methods

NuttX supports arc4random_buf which provides better entropy and security compared to the legacy random number generation methods.
…ompiler-errors

New tracking issues for const_ops and const_cmp

Let's do a clean start with new tracking issues to avoid mixing things up with the previous constification.

I assume the fact that the `PartialEq` *trait* and *impls* used different feature names  was a mistake (the feature name on the impl is entirely irrelevant anyway).

Part of rust-lang#143800, rust-lang#143802

r? ``@oli-obk``
…ieu,tgross35

slice: Mark `rotate_left`, `rotate_right` unstably const

Tracking issue rust-lang#143812

- Add the const unstable `const_slice_rotate` feature
- Mark `<[T]>::rotate_left` and `<[T]>::rotate_right` as const unstable

The internal rotate functions use [`<*mut T>::replace`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.replace) and [`ptr::swap_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/fn.swap_nonoverlapping.html) which were const-stabilized in 1.88.

Two changes were needed in the `rotate.rs` module to make these functions const:
1. A usage of `cmp::min` was replaced with a local function implementation of [`Ord::min`](https://doc.rust-lang.org/1.88.0/src/core/cmp.rs.html#1048-1053).
2. A `for start in 1..gcd` loop was changed to a while loop with an increment variable.

This needs libs-api approval and cc-ing const-eval.
constify `From` and `Into`

tracking issue rust-lang#143773

r? ``````@fee1-dead``````

I did not mark any impls elsewhere as `const`, those can happen on their own timeframe and don't need to be part of this MVP. But if there are some core ones you think should be in there I'll happily add them, just couldn't think of any
… r=petrochenkov

make `cfg_select` a builtin macro

tracking issue: rust-lang#115585

This parses mostly the same as the `macro cfg_select` version, except:

1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected.
2. in an expression context, the rhs is no longer wrapped in a block, so that this now works:
  ```rust
  fn main() {
      println!(cfg_select! {
          unix => { "foo" }
          _ => { "bar" }
      });
  }
  ```
3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works

I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule.

cc `@traviscross` if I'm missing any feature that should/should not be included
r? `@petrochenkov` for the macro logic details
@github-actions github-actions bot requested a review from a team as a code owner July 22, 2025 14:47
@carolynzech carolynzech reopened this Jul 22, 2025
@tautschnig
Copy link
Member

@rafaelsamenezes Would you be able to look into the GOTO Transcoder CI issue?

@nilehmann Would you be able to look into the Flux build issue?

Not a blocker for us in either case, but we'd prefer not to carry CI failures for too long a time.

@nilehmann
Copy link

@tautschnig, this will happen every time there's a subtree sync because Flux needs to match the toolchain. To fix CI, we need to update the flux version in the workflow (after merging flux-rs/flux#1194). I'm, of course, willing to keep Flux in sync, but going forward, what would be the best way to coordinate this update?

@nilehmann
Copy link

I want to minimize coordination, so something that may work is to disable Flux in CI when the toolchain falls behind (both in the subtree update PR and after merging). We can then update at our own pace in a subsequent PR. So far, I've been able to make the necessary changes to Flux during the period the subtree update PR is open.

@tautschnig
Copy link
Member

I want to minimize coordination, so something that may work is to disable Flux in CI when the toolchain falls behind (both in the subtree update PR and after merging). We can then update at our own pace in a subsequent PR. So far, I've been able to make the necessary changes to Flux during the period the subtree update PR is open.

@nilehmann I don't really mind having Flux for a bit of time, I just wanted to make sure those aren't terribly long periods of time. Do you already have mechanisms in place to be notified when a toolchain update might break Flux? If not, do you just want us to ping you (in the same way as done on this occasion) when a toolchain update breaks Flux?

For this PR I have now included 7d155b1 so as to update Flux thanks to your work in flux-rs/flux#1194.

@carolynzech carolynzech enabled auto-merge July 23, 2025 14:14
@carolynzech carolynzech added this pull request to the merge queue Jul 23, 2025
Merged via the queue into main with commit 34236a6 Jul 23, 2025
25 of 26 checks passed
@carolynzech carolynzech deleted the sync-2025-07-14 branch July 23, 2025 15:11
@nilehmann
Copy link

@tautschnig, yes, I get a notification when Flux fails. Thanks for including 7d155b1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.