close
Skip to content

Rollup of 12 pull requests#155472

Merged
rust-bors[bot] merged 35 commits intorust-lang:mainfrom
jhpratt:rollup-cFOYOWJ
Apr 18, 2026
Merged

Rollup of 12 pull requests#155472
rust-bors[bot] merged 35 commits intorust-lang:mainfrom
jhpratt:rollup-cFOYOWJ

Conversation

@jhpratt
Copy link
Copy Markdown
Member

@jhpratt jhpratt commented Apr 18, 2026

Successful merges:

r? @ghost

Create a similar rollup

DanielEScherzer and others added 30 commits March 6, 2026 10:24
For `gnu` function_sections is off by default.
This creates an empty iterator, like `repeat_n(value, 0)` but without
needing any such value at hand. There's precedent in many other
iterators that the `Default` is empty, like `slice::Iter`.

I found myself wanting this for rayon's `RepeatN` as it lowers to a
sequential iterator [here][1]. Since rayon is also optimizing to avoid
extra clones, it may end up with parallel splits that have count 0 and
no item value. Calling `std::iter::repeat_n(x, 0)` just drops that
value, but there's no way to construct the same result without a value
yet. This would be straightforward with an empty `Default`.

[1]: https://github.com/rayon-rs/rayon/blob/ae07384e3e0b238cea89f0c14891f351c65a5cee/src/iter/repeat.rs#L201-L202
The one where this was copied from has since been updated.
All but one of the bullet points ended with a period; add the missing period.
…, r=Amanieu

naked functions: respect `function-sections`

fixes rust-lang#147789

r? @Amanieu
…cottmcm

Add Sized supertrait for CoerceUnsized and DispatchFromDyn

This is part of rust-lang#149094. I did not include `Receiver` because I think it is correct to allow non-sized receivers.
…gross35

`impl Default for RepeatN`

This creates an empty iterator, like `repeat_n(value, 0)` but without
needing any such value at hand. There's precedent in many other
iterators that the `Default` is empty, like `slice::Iter`.

I found myself wanting this for rayon's `RepeatN` as it lowers to a
sequential iterator [here][1]. Since rayon is also optimizing to avoid
extra clones, it may end up with parallel splits that have count 0 and
no item value. Calling `std::iter::repeat_n(x, 0)` just drops that
value, but there's no way to construct the same result without a value
yet. This would be straightforward with an empty `Default`.

[1]: https://github.com/rayon-rs/rayon/blob/ae07384e3e0b238cea89f0c14891f351c65a5cee/src/iter/repeat.rs#L201-L202

r? libs-api (insta-stable)
`std::any::TypeId`: remove misplaced "and" in `Unique<T>` example
Move recursion out of `MatchPairTree::for_pattern` helpers

The helper functions now just iterate over the relevant subpatterns, while leaving recursion up to the main function.

This avoids passing parameters that were only used for recursive plumbing, and consolidates all recursive calls into `for_pattern` itself, which should make it easier to experiment with changes to the recursive structure.

There should be no change to compiler behaviour.
…itor

Fix misleading "borrowed data escapes outside of function" diagnostic

Fixes rust-lang#154350

Fall back to `report_general_error()` when `fr_name_and_span` is `None` in function items, since the "escaping data" framing is only appropriate for closures capturing outside variables.
…th_addr, r=scottmcm

ptr: update text in intro text to one in with_addr doc

The one where this was copied from has since been updated.
jhpratt added 5 commits April 18, 2026 00:05
Fix ICE in borrowck mutability suggestion with multi-byte ref sigil

Fixes rust-lang#139089

Similarly to rust-lang#155068, this is another instance where span arithmetic did not account for multi-byte characters. (Note that the ampersand in the test is full-width)

This change also results in correcting some inappropriate suggestions.
rustdoc: Fix `redundant_explicit_links` incorrectly firing (or not firing) under certain scenarios

Hi! I found some issues with the `rustdoc::redundant_explicit_links` lint while working on a personal project.

- After skipping a link that contains inline markups, the lint would incorrectly skip all the remaining links.

  For example, with the following snippet, the lint is fired for `[Option][Option]`, but not `[Result][Result]`:

  ```rs
  //! [Option][Option]
  //! [**u8**][u8]     (skipped)
  //! [Result][Result]
  ```

  Happening because of a `?` causing a loop to bail early:

  https://github.com/rust-lang/rust/blob/a4a37ed163a6c1d227b58047d91457589c611cf8/src/librustdoc/passes/lint/redundant_explicit_links.rs#L107

- The lint is fired for links that specify titles (like `[link](link "title")`), except that wouldn't be applicable because it's not possible to specify a title without there also being an explicit target. For example:

  ```
  error: redundant explicit link target
  --> <anon>:5:12
    |
  5 | /// [drop](drop "This function is not magic")
    |      ----  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant
    |      |
    |      because label contains path that resolves to same destination
    |
    = note: when a link's destination is not specified,
            the label is used to resolve intra-doc links
  help: remove explicit link target
    |
  5 - /// [drop](drop "This function is not magic")
  5 + /// [drop]
    |
  ```

These are found as of:

```
rustdoc 1.97.0-nightly (1b8f2e4 2026-04-17)
binary: rustdoc
commit-hash: 1b8f2e4
commit-date: 2026-04-17
host: aarch64-apple-darwin
release: 1.97.0-nightly
LLVM version: 22.1.2
```

(Note: I ran `./x test tests/rustdoc-ui` locally, but not `./x tidy` due to my slow internet. There was an unrelated failed test at `tests/rustdoc-ui/ice-bug-report-url.rs` which I'm not sure about)
Remove unnecessary safety conditions related to unchecked uint arithmetic

Improve the safety documentation of three unsafe APIs related to unsigned integer arithmetic.

- [unchecked_add](https://doc.rust-lang.org/nightly/core/primitive.usize.html#method.unchecked_add): It is impossible for `self + rhs < usize::MIN`.
- [unchecked_sub](https://doc.rust-lang.org/nightly/core/primitive.usize.html#method.unchecked_sub): It is impossible for `self - rhs > usize::MAX`.
- [unchecked_mul](https://doc.rust-lang.org/nightly/core/primitive.usize.html#method.unchecked_mul): It is impossible for `self * rhs < usize::MIN`.

The examples use `usize` for demonstration. All unsigned integer types suffer from the same issue because their APIs are generated by the same macro `uint_impl`, and fixing the macro documentation will fix them all.
docs: Fix typo in std/src/thready/scoped.rs

# Fix typo in std/src/thread/scoped.rs

## Why this pr

This PR fixes the typo mentioned in rust-lang#155275.

I know this was originally fixed in rust-lang#155325 and then in rust-lang#155328.

But since the first issue was closed due to some ai slop and the second one was closed because the first one was already opened, it seems to me that this PR is still needed.

## What this pr does

This PR "just" fixes a typo inside the `std/src/thread/scoped.rs` file

Changing the comment from this:

```
/// borrow non-`'static` data from the outside the scope. See [`scope`] for
/// details.
```

to this:

```
/// borrow non-`'static` data from outside the scope. See [`scope`] for
/// details.
```
`std::error::Request`: clean up documentation
@rust-bors rust-bors bot added the rollup A PR which is a rollup label Apr 18, 2026
@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 18, 2026
@jhpratt
Copy link
Copy Markdown
Member Author

jhpratt commented Apr 18, 2026

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 18, 2026

📌 Commit 0bfd952 has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 18, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 18, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 18, 2026

☀️ Test successful - CI
Approved by: jhpratt
Duration: 3h 14m 6s
Pushing 7a38981 to main...

@rust-bors rust-bors bot merged commit 7a38981 into rust-lang:main Apr 18, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 2f201bc (parent) -> 7a38981 (this PR)

Test differences

Show 233 test diffs

Stage 1

  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#linux-x86-gnu-fs-false: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#linux-x86-gnu-fs-true: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#macos-aarch64-fs-false: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#macos-aarch64-fs-true: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-gnu-fs-false: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-gnu-fs-true: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-msvc-fs-false: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-msvc-fs-true: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#x86-uefi-fs-false: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#x86-uefi-fs-true: [missing] -> pass (J0)
  • [assembly] tests/assembly-llvm/naked-functions/link-section-windows.rs#x86-uefi: [missing] -> pass (J0)
  • [crashes] tests/crashes/139089.rs: pass -> [missing] (J0)
  • [run-make] tests/run-make/naked-dead-code-elimination: [missing] -> pass (J0)
  • [ui] tests/rustdoc-ui/lints/redundant_explicit_links-some-skipped.rs: [missing] -> pass (J0)
  • [ui] tests/rustdoc-ui/lints/redundant_explicit_links-with-title.rs: [missing] -> pass (J0)
  • [ui] tests/ui/borrowck/fn-ptr-lifetime-mismatch-with-impl-trait-arg.rs: [missing] -> pass (J0)
  • [ui] tests/ui/self/arbitrary-self-types-dyn-receiver.rs: [missing] -> pass (J0)
  • [ui] tests/ui/span/mutability-suggestion-fullwidth-ampersand.rs: [missing] -> pass (J0)
  • [ui] tests/ui/traits/dyn-coerce-unsized-ice.rs: [missing] -> pass (J0)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#linux_no_function_sections: [missing] -> pass (J2)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_i686: pass -> [missing] (J2)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_i686_gnu: [missing] -> pass (J2)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86: pass -> [missing] (J2)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86_gnu: [missing] -> pass (J2)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86_gnu_function_sections: [missing] -> pass (J2)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86_msvc: [missing] -> pass (J2)
  • iter::sources::test_repeat_n_default: [missing] -> pass (J2)

Stage 2

  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#linux-x86-gnu-fs-false: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#linux-x86-gnu-fs-true: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#macos-aarch64-fs-false: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#macos-aarch64-fs-true: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-gnu-fs-false: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-gnu-fs-true: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-msvc-fs-false: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#windows-x86-msvc-fs-true: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#x86-uefi-fs-false: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/function-sections.rs#x86-uefi-fs-true: [missing] -> pass (J1)
  • [assembly] tests/assembly-llvm/naked-functions/link-section-windows.rs#x86-uefi: [missing] -> pass (J1)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#linux_no_function_sections: [missing] -> pass (J1)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_i686: pass -> [missing] (J1)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_i686_gnu: [missing] -> pass (J1)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86: pass -> [missing] (J1)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86_gnu: [missing] -> pass (J1)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86_gnu_function_sections: [missing] -> pass (J1)
  • [codegen] tests/codegen-llvm/naked-fn/naked-functions.rs#win_x86_msvc: [missing] -> pass (J1)
  • [ui] tests/ui/borrowck/fn-ptr-lifetime-mismatch-with-impl-trait-arg.rs: [missing] -> pass (J3)
  • [ui] tests/ui/self/arbitrary-self-types-dyn-receiver.rs: [missing] -> pass (J3)
  • [ui] tests/ui/span/mutability-suggestion-fullwidth-ampersand.rs: [missing] -> pass (J3)
  • [ui] tests/ui/traits/dyn-coerce-unsized-ice.rs: [missing] -> pass (J3)
  • [ui] tests/rustdoc-ui/lints/redundant_explicit_links-some-skipped.rs: [missing] -> pass (J4)
  • [ui] tests/rustdoc-ui/lints/redundant_explicit_links-with-title.rs: [missing] -> pass (J4)
  • [run-make] tests/run-make/naked-dead-code-elimination: [missing] -> pass (J5)
  • [crashes] tests/crashes/139089.rs: pass -> [missing] (J6)
  • [run-make] tests/run-make/naked-dead-code-elimination: [missing] -> ignore (ignored when cross-compiling) (J7)
  • iter::sources::test_repeat_n_default: [missing] -> pass (J8)

Additionally, 178 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 7a38981b365e4c3672053b910fce9a14c6555ab9 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. i686-gnu-2: 1h 12m -> 1h 44m (+43.6%)
  2. x86_64-msvc-ext1: 2h 15m -> 1h 40m (-25.7%)
  3. x86_64-gnu-llvm-22-2: 1h 36m -> 1h 14m (-22.3%)
  4. x86_64-gnu-miri: 1h 19m -> 1h 34m (+19.0%)
  5. armhf-gnu: 1h 20m -> 1h 34m (+16.9%)
  6. i686-gnu-nopt-1: 1h 59m -> 2h 18m (+15.5%)
  7. x86_64-gnu-llvm-21-2: 1h 23m -> 1h 35m (+15.0%)
  8. pr-check-1: 28m 20s -> 32m 31s (+14.8%)
  9. optional-x86_64-gnu-parallel-frontend: 2h 22m -> 2h 43m (+14.6%)
  10. aarch64-apple: 2h 42m -> 3h 6m (+14.6%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#139690 impl Default for RepeatN 96b3eff01f9c3772e4ca1072af57c5a3f2fb34ba (link)
#147811 naked functions: respect function-sections 392560b5621f5200c0c4281a8ead4f4451f156f0 (link)
#153511 std::any::TypeId: remove misplaced "and" in Unique<T> e… e0441d8c26fb3982438f4e5a7fb041edd3a795a9 (link)
#154935 Add Sized supertrait for CoerceUnsized and DispatchFromDyn be6a7fbceb07785abbdb4a23d879fab748854543 (link)
#154943 Move recursion out of MatchPairTree::for_pattern helpers e91e82aa48cd4cae29ee341145e2a5dd92d12104 (link)
#155295 Fix misleading "borrowed data escapes outside of function" … 136dd5a2de783f54a23cbb2299680b4356b592ba (link)
#155427 ptr: update text in intro text to one in with_addr doc 73465136bca69a5e21523a9511775291189edf61 (link)
#155428 Fix ICE in borrowck mutability suggestion with multi-byte r… ce23235bb9e29ee18b48d83983669c1481140bfb (link)
#155435 rustdoc: Fix redundant_explicit_links incorrectly firing … d50ba42ffd62b415bd5594d49124b6b95c312817 (link)
#155450 Remove unnecessary safety conditions related to unchecked u… 4ace9e62efb71bb0581b762fc85ab8b76555d3c3 (link)
#155454 docs: Fix typo in std/src/thready/scoped.rs 778f1f70d00ad03444a2f0428cfe0a01d3ab7070 (link)
#155467 std::error::Request: clean up documentation 468b9550cd85f47826aab2a7df810d6feb52a259 (link)

previous master: 2f201bccb3

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (7a38981): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

This perf run didn't have relevant results for this metric.

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 491.618s -> 492.147s (0.11%)
Artifact size: 394.25 MiB -> 394.26 MiB (0.00%)

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

Labels

A-run-make Area: port run-make Makefiles to rmake.rs merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.