Skip to content

Rollup of 12 pull requests#155851

Merged
rust-bors[bot] merged 34 commits intorust-lang:mainfrom
jhpratt:rollup-Jst4hhC
Apr 27, 2026
Merged

Rollup of 12 pull requests#155851
rust-bors[bot] merged 34 commits intorust-lang:mainfrom
jhpratt:rollup-Jst4hhC

Conversation

@jhpratt
Copy link
Copy Markdown
Member

@jhpratt jhpratt commented Apr 27, 2026

Successful merges:

r? @ghost

Create a similar rollup

Flakebi and others added 30 commits December 29, 2025 21:56
Targets that set `requires_lto = true` were not actually using lto when
compiling with cargo by default. They needed an extra `lto = true` in
`Cargo.toml` to work.

Fix this by letting lto take precedence over the `embed_bitcode` flag
when lto is required by a target.

If both these flags would be supplied by the user, an error is
generated. However, this did not happen when lto was requested by the
target instead of the user.
- Follow UEFI Shell search flow to search for programs while launching.
- Tested using OVMF on QEMU.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Commit cb37ee2 ("make field representing types invariant over the
base type") made the auto-trait impl work even if `T: !Send` or `T:
!Sync` thus we can remove these explicit unsafe impls while FRTs still
implement `Send` and `Sync`.
Using the reflection experiment, we can print the actual names of the
field that an FRT is referring to. In case this breaks, there is an
alternative implementation in the note comment.
Eliminate `cursor` and `ibuf` as named variables, as their presence
makes things more confusing.
`mk_place_elem` appends a single `PlaceElem` to an existing (interned)
projection. The current implementation copies the projection into a
fresh `Vec`, pushes the new element, and re-interns the slice, which
allocates on the heap on every call.

Feed the elements through `mk_place_elems_from_iter` so that
`CollectAndApply`'s hand-unrolled stack fast path (up to 9 elements,
in `rustc_type_ir::interner`) kicks in for the common case of short
projections and the `Vec` allocation is skipped entirely. The behavior
is identical for longer projections (the fast path falls back to a
`Vec` internally).
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
* Fix heap overflow in slice join via inconsistent Borrow
* Update library/alloc/src/str.rs

Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
Fix requires_lto targets needing lto set in cargo

Targets that set `requires_lto = true` were not actually using lto when compiling with cargo by default. They needed an extra `lto = true` in `Cargo.toml` to work.

Fix this by letting lto take precedence over the `embed_bitcode` flag when lto is required by a target.

If both these flags would be supplied by the user, an error is generated. However, this did not happen when lto was requested by the target instead of the user.

Fixes rust-lang#148514
Tracking issue: rust-lang#135024
…lacrum

`std::io::Take`: Clarify & optimize `BorrowedBuf::set_init` usage.

Don't initialize `buf` if it was already initialized. Clarify safety comments.

Move the `buf.advance()` call to make the initialization more like
calling `buf.ensure_init()`, then clarify how the code here is an
optimized variant of `ensure_init`.
…crum

Make Rcs and Arcs use pointer comparison for unsized types

`Rc` and `Arc`s have an `Eq` implementation that first attempt to compare the pointers as an optimization. This, however, was not extended to DSTs, which is what this PR fixes.

Fixes rust-lang#154998.
…ulacrum

Implement more traits for FRTs

From rust-lang#154927 (comment).

FRTs now implement the following traits: `Sized + Freeze + RefUnwindSafe + Send + Sync + Unpin + UnsafeUnpin + UnwindSafe + Copy + Debug + Default + Eq + Hash + Ord`.

Let me know if there is any trait missing.

I also removed the explicit  `Send` and `Sync` impls, since commit cb37ee2 ("make field representing types invariant over the base type") made the auto-trait impl work even if `T: !Send` or `T: !Sync`. Very happy to see unsafe impls get dropped :)

Note that I used the reflection feature (cc @oli-obk) to print the actual field names in the debug implementation. I think this is a cool way to use it, but if it isn't ready for that, I'm happy to change it to the alternative implementation I gave in the note comment (it's essentially Mark's suggestion but printing `T`'s name instead of `Self`'s).

Since this is a library change, I'll give this to Mark; feel free to also take a look/leave comments, Oli :)

r? @Mark-Simulacrum
…ulacrum

Fix heap overflow in slice::join caused by misbehaving Borrow

This code allocates a buffer using lengths calculated by calling `.borrow()` on some slices, and then copies them over after again calling `.borrow()`. There is no safety-reliable guarantee that these will return the same slices.

While this code calls `.borrow()` three times, only one of them is problematic: the others already use checked indexing.

I made the test a normal library test, but let me know if it should go elsewhere.

Bug discovered by Rust Foundation Security using AI. I'm just helping with the patch as a member of wg-security-response. We do not believe this bug needs embargo, it is a soundness fix for hard-to-trigger unsoundness.
…id-vec-alloc, r=cjgillot,JohnTitor

Avoid Vec allocation in TyCtxt::mk_place_elem

`mk_place_elem` appends a single `PlaceElem` to an existing (interned) projection. The current implementation copies the projection into a fresh `Vec`, pushes the new element, and re-interns the slice, which allocates on every call.

Feed the elements through `mk_place_elems_from_iter` so that `CollectAndApply`'s hand-unrolled stack fast path (up to 9 elements, in `rustc_type_ir::interner`) kicks in for the common case of short projections and the `Vec` allocation is skipped entirely. The behavior is identical for longer projections (the fast path falls back to a `Vec` internally).
…,nicholasbishop

std: sys: process: uefi: Add program searching

- Follow UEFI Shell search flow to search for programs while launching.
- Tested using OVMF on QEMU.

@rustbot label +O-UEFI
Add boxing suggestions for `impl Trait` return type mismatches

A sort of a follow up pr to this -> rust-lang#155546
jhpratt added 4 commits April 26, 2026 21:56
…re-return-note, r=wesleywiser

Avoid misleading closure return type note

Fixes rust-lang#155670
…=mejrs

Convert attribute `FinalizeFn` to fn pointer
rustc_attr_parsing: use a `try {}` in `or_malformed`
… r=wesleywiser

couple of `crate_name` cleanups

Split out from rust-lang#153924; these changes should be uncontroversial.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Apr 27, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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. labels Apr 27, 2026
@jhpratt
Copy link
Copy Markdown
Member Author

jhpratt commented Apr 27, 2026

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 27, 2026

📌 Commit bd2d1a8 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 27, 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 27, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 27, 2026

☀️ Test successful - CI
Approved by: jhpratt
Duration: 3h 21m 28s
Pushing 4933094 to main...

@rust-bors rust-bors Bot merged commit 4933094 into rust-lang:main Apr 27, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 27, 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 ca9a134 (parent) -> 4933094 (this PR)

Test differences

Show 117 test diffs

Stage 1

  • arc::eq_unsized: [missing] -> pass (J1)
  • arc::eq_unsized_slice: [missing] -> pass (J1)
  • rc::eq_unsized: [missing] -> pass (J1)
  • rc::eq_unsized_slice: [missing] -> pass (J1)
  • str::test_join_inconsistent_borrow: [missing] -> pass (J1)
  • [run-make] tests/run-make-cargo/amdgpu-lto: [missing] -> ignore (ignored on targets without Rust's LLD) (J2)
  • [ui] tests/ui/closures/closure-return-block-note-issue-155670.rs: [missing] -> pass (J2)
  • [ui] tests/ui/field_representing_types/not-field-if-unsized.rs#next: [missing] -> pass (J2)
  • [ui] tests/ui/field_representing_types/not-field-if-unsized.rs#old: [missing] -> pass (J2)

Stage 2

  • arc::eq_unsized: [missing] -> pass (J0)
  • arc::eq_unsized_slice: [missing] -> pass (J0)
  • rc::eq_unsized: [missing] -> pass (J0)
  • rc::eq_unsized_slice: [missing] -> pass (J0)
  • str::test_join_inconsistent_borrow: [missing] -> pass (J0)
  • [run-make] tests/run-make-cargo/amdgpu-lto: [missing] -> ignore (ignored on targets without Rust's LLD) (J3)
  • [run-make] tests/run-make-cargo/amdgpu-lto: [missing] -> pass (J4)
  • [ui] tests/ui/closures/closure-return-block-note-issue-155670.rs: [missing] -> pass (J5)
  • [ui] tests/ui/field_representing_types/not-field-if-unsized.rs#next: [missing] -> pass (J5)
  • [ui] tests/ui/field_representing_types/not-field-if-unsized.rs#old: [missing] -> pass (J5)

Additionally, 98 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 4933094f25ba1edf2de0a203665976832fc85bc9 --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. dist-aarch64-linux: 2h 39m -> 1h 53m (-28.7%)
  2. x86_64-msvc-2: 2h 36m -> 1h 54m (-26.7%)
  3. optional-x86_64-gnu-parallel-frontend: 2h 3m -> 2h 36m (+26.5%)
  4. x86_64-gnu-llvm-21-1: 1h 13m -> 57m 29s (-22.2%)
  5. dist-i686-mingw: 2h 46m -> 2h 12m (-20.9%)
  6. x86_64-msvc-1: 2h 28m -> 2h 3m (-17.1%)
  7. x86_64-mingw-1: 2h 59m -> 2h 38m (-11.4%)
  8. dist-x86_64-freebsd: 1h 23m -> 1h 33m (+11.1%)
  9. x86_64-rust-for-linux: 55m 39s -> 49m 29s (-11.1%)
  10. x86_64-msvc-ext1: 2h 5m -> 2h 17m (+9.5%)
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
#149624 Fix requires_lto targets needing lto set in cargo 4b535ca2e2f4aaba30885b8429fa1a5dae1b9ede (link)
#151014 std: sys: process: uefi: Add program searching c1c5bef36c15cd55ab1713e9fb8e68616bf8bfbb (link)
#155317 std::io::Take: Clarify & optimize BorrowedBuf::set_init 442a45cab3aef966f10d018ad0366edbd96abe7d (link)
#155579 Make Rcs and Arcs use pointer comparison for unsized types b31745bbda31e1247559277d1a0ac98e7d8fa0a6 (link)
#155588 Implement more traits for FRTs 14456c2318f4f355fee5bc8b79cebc98c28b9de2 (link)
#155682 Add boxing suggestions for impl Trait return type mismatc… 34b30f62e6096078c3cbe12a2c70529a0ce4b519 (link)
#155708 Fix heap overflow in slice::join caused by misbehaving Borr… 338ce9b6ad9db6e206b4cb66ad2a94b62ece39a8 (link)
#155770 Avoid misleading closure return type note b5b3cc0d5cf18116dfbdb424191f03cbed6ad1e8 (link)
#155778 Avoid Vec allocation in TyCtxt::mk_place_elem b31ab01565b9b21f437c64ef10bd567b490cf930 (link)
#155818 Convert attribute FinalizeFn to fn pointer 57243e1d06af423195ca07380a3655dbb01f9723 (link)
#155829 rustc_attr_parsing: use a try {} in or_malformed bf34e16ee6563b022bb918281824e6c331bd7cde (link)
#155835 couple of crate_name cleanups 410deb7ee54b4b6042f5149c63c6a83a0fbdc87f (link)

previous master: ca9a134e09

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 (4933094): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.5% [1.5%, 1.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.5%, secondary -1.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.1% [0.7%, 3.5%] 2
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
-2.6% [-2.6%, -2.6%] 1
Improvements ✅
(secondary)
-3.0% [-5.1%, -1.7%] 3
All ❌✅ (primary) 0.5% [-2.6%, 3.5%] 3

Cycles

Results (secondary 5.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.5% [5.5%, 5.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.1%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 2
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.6%, 0.1%] 3

Bootstrap: 488.117s -> 488.817s (0.14%)
Artifact size: 393.52 MiB -> 393.48 MiB (-0.01%)

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.