Skip to content

Rollup of 7 pull requests - #166582

Closed
JonathanBrouwer wants to merge 27 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-RF8OsRR
Closed

JonathanBrouwer wants to merge 27 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-RF8OsRR

Conversation

@JonathanBrouwer

@JonathanBrouwer JonathanBrouwer commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

machinedramon and others added 27 commits October 18, 2026 19:16
When no field of a `Reborrow` type is reborrowed, borrowck borrows the
whole source value instead. That fallback assumed the target type has
exactly one lifetime and hit a `bug!` otherwise, even though `Reborrow`
impls on types with several lifetimes are accepted.

Borrow the source under each of the target's lifetimes instead. The one
lifetime case is unchanged, and the source stays borrowed for as long as
any of the target's lifetimes is live.
And stop accepting empty directive names & empty values (after the `:`).
* Reject revision names that aren't a sequence of alphanumeric chars,
  `-` and `_`.
* Reject conditional `revision` directives (e.g., `//@[r] revisions: q`).
The existing arm was trying to match with a diagnostic named "String",
which doesn't exist and was dead code that never actually matched any
case.

Replace and fix the match condition by matching the definition id with
the `String` `LangItem` instead as `String` exists as a LangItem and not
a diagnostic item.

Update tests that were affecting by this change.
Share retain implementation between Vec and VecDeque

It treats Vec and VecDeque as two seperate regions, allowing them to share the same retain implementation.

When processing the buffer, `retain_raw` splits the logical ring buffer into up to two contiguous regions. Each region is processed independently: elements rejected by f are dropped, while retained elements are moved to fill holes.

Compared to the regional code, due to wrapping, there are some regressions on the small buffers for `Vec`.

Type | Group | Small (4–32 elems) | Medium (64–512 elems) | Large (1k–100k elems)
-- | -- | -- | -- | --
Vec | keep even | +1% to 0% | 0% to -1% | +1% to -1%
Vec | keep all | 0% | 0% to -4% | 0%
Vec | iter + collect reference | 0% to -1% | 0% | 0%
VecDeque | keep all / contiguous | +19% to -30% | -43% to -48% | -49% to -50%
VecDeque | keep all / wrapped | +6% to -23% | -34% to -49% | -49% to -51%
VecDeque | keep even / contiguous | -5% to -26% | -28% to -31% | about -30%
VecDeque | keep even / wrapped | +12% to -15% | -30% to -32% | -33% to -36%
VecDeque | keep second half / contiguous | +4% to -43% | -52% to -56% | -54% to -56%
VecDeque | keep second half / wrapped | +9% to -35% | -49% to -57% | -58% to -59%
VecDeque | random 50% / contiguous | +23% to -14% | -23% to -29% | -27% to -73%
VecDeque | random 50% / wrapped | +6% to -1% | -15% to -30% | -26% to -70%

<details>
<summary>Detailed Vec benchmark results</summary>

### Vec (`vec::bench_retain_*`), ns/iter: before → after (change)

#### Keep even values

|     | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| u8 | 6.9 → 6.9 (-0%) | 9.1 → 9.1 (+0%) | 14.9 → 14.9 (-0%) | 25.9 → 25.9 (+0%) | 53.8 → 53.8 (+0%) | 98.7 → 98.7 (+0%) | 187.7 → 187.7 (+0%) | 367.8 → 367.8 (-0%) | 718.2 → 718.1 (-0%) | 7.2k → 7.2k (+0%) | 71.8k → 71.8k (-0%) |
| u16 | 6.2 → 6.2 (+0%) | 9.4 → 9.5 (+1%) | 14.6 → 14.6 (+0%) | 27.1 → 27.1 (+0%) | 54.5 → 54.5 (+0%) | 99.5 → 99.5 (+0%) | 190.5 → 190.5 (+0%) | 373.4 → 373.5 (+0%) | 737.8 → 737.8 (+0%) | 7.4k → 7.4k (+0%) | 74.3k → 74.4k (+0%) |
| u32 | 6.6 → 6.5 (-0%) | 8.4 → 8.4 (+0%) | 15.0 → 15.0 (-0%) | 27.1 → 27.1 (-0%) | 54.5 → 54.5 (-0%) | 102.1 → 102.1 (+0%) | 195.8 → 195.8 (-0%) | 397.0 → 392.2 (-1%) | 780.6 → 788.1 (+1%) | 7.8k → 7.9k (+0%) | 79.1k → 78.3k (-1%) |
| u64 | 5.5 → 5.5 (+0%) | 9.4 → 9.4 (+0%) | 15.8 → 15.8 (+0%) | 28.3 → 28.3 (+0%) | 57.9 → 58.0 (+0%) | 109.5 → 109.5 (+0%) | 228.3 → 228.4 (+0%) | 461.2 → 457.7 (-1%) | 904.1 → 904.2 (+0%) | 9.1k → 9.1k (-0%) | 91.6k → 91.5k (-0%) |

#### Keep all (`whole`)

|     | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| u8 | 3.0 → 3.0 (+0%) | 5.1 → 5.1 (+0%) | 9.4 → 9.4 (+0%) | 18.6 → 18.6 (+0%) | 37.0 → 37.0 (+0%) | 74.4 → 74.4 (+0%) | 152.8 → 152.8 (-0%) | 359.9 → 359.9 (-0%) | 697.1 → 697.1 (-0%) | 6.9k → 6.9k (-0%) | 68.8k → 68.7k (-0%) |
| u16 | 3.2 → 3.2 (+0%) | 5.4 → 5.4 (+0%) | 9.9 → 9.9 (+0%) | 19.4 → 19.4 (+0%) | 38.8 → 38.8 (+0%) | 77.3 → 77.6 (+0%) | 155.2 → 154.6 (-0%) | 313.3 → 313.3 (+0%) | 604.5 → 605.5 (+0%) | 6.0k → 6.0k (+0%) | 60.2k → 60.2k (+0%) |
| u32 | 3.0 → 3.0 (+0%) | 5.1 → 5.1 (+0%) | 9.4 → 9.4 (+0%) | 18.6 → 18.6 (+0%) | 37.0 → 37.0 (+0%) | 74.4 → 74.5 (+0%) | 157.7 → 152.8 (-3%) | 359.9 → 359.9 (-0%) | 697.2 → 697.1 (-0%) | 6.9k → 6.9k (-0%) | 69.0k → 69.0k (-0%) |
| u64 | 3.0 → 3.0 (+0%) | 5.1 → 5.1 (+0%) | 9.4 → 9.4 (+0%) | 18.6 → 18.6 (+0%) | 37.0 → 36.9 (-0%) | 74.4 → 74.4 (-0%) | 164.2 → 157.7 (-4%) | 359.9 → 359.9 (-0%) | 698.5 → 697.8 (-0%) | 6.9k → 6.9k (-0%) | 68.9k → 68.8k (-0%) |

#### Reference: `into_iter().filter().collect()`

|     | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| u32 | 6.7 → 6.7 (+0%) | 10.9 → 10.9 (+0%) | 17.3 → 17.4 (+0%) | 30.1 → 29.9 (-1%) | 57.6 → 57.6 (+0%)

</details>

<details>
<summary>Detailed VecDeque benchmark results</summary>

### VecDeque (`vec_deque::bench_retain_*`, u32), ns/iter: before → after (change)

| Group | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| keep all, contiguous | 8.4 → 10.0 (+19%) | 11.0 → 11.0 (-0%) | 17.8 → 14.8 (-17%) | 30.2 → 21.1 (-30%) | 56.7 → 32.3 (-43%) | 110.7 → 60.5 (-45%) | 215.2 → 113.6 (-47%) | 425.8 → 222.6 (-48%) | 823.6 → 420.1 (-49%) | 8.2k → 4.1k (-50%) | 81.1k → 40.6k (-50%) |
| keep all, wrapped | 11.2 → 11.8 (+6%) | 14.6 → 12.9 (-11%) | 20.6 → 17.4 (-15%) | 33.4 → 25.8 (-23%) | 58.6 → 38.4 (-34%) | 112.8 → 65.1 (-42%) | 221.7 → 115.8 (-48%) | 436.2 → 222.1 (-49%) | 837.8 → 430.1 (-49%) | 8.3k → 4.1k (-51%) | 81.6k → 40.7k (-50%) |
| keep even, contiguous | 10.1 → 9.6 (-5%) | 14.2 → 12.1 (-15%) | 22.5 → 17.9 (-20%) | 39.7 → 29.3 (-26%) | 80.6 → 58.0 (-28%) | 148.0 → 103.5 (-30%) | 283.6 → 197.7 (-30%) | 558.1 → 387.8 (-31%) | 1.1k → 762.5 (-30%) | 10.7k → 7.5k (-30%) | 106.6k → 75.0k (-30%) |
| keep even, wrapped | 13.4 → 14.2 (+6%) | 17.6 → 19.8 (+12%) | 26.6 → 25.9 (-3%) | 45.6 → 38.6 (-15%) | 88.7 → 62.5 (-30%) | 163.2 → 114.9 (-30%) | 316.9 → 221.1 (-30%) | 618.5 → 423.1 (-32%) | 1.2k → 801.9 (-33%) | 11.9k → 7.6k (-36%) | 118.2k → 75.2k (-36%) |
| keep second half, contiguous | 10.4 → 10.8 (+4%) | 14.4 → 12.7 (-12%) | 23.2 → 17.9 (-23%) | 41.9 → 23.8 (-43%) | 91.8 → 40.8 (-56%) | 158.3 → 76.6 (-52%) | 306.6 → 141.7 (-54%) | 610.3 → 285.6 (-53%) | 1.2k → 537.6 (-54%) | 11.6k → 5.1k (-56%) | 115.2k → 50.6k (-56%) |
| keep second half, wrapped | 13.5 → 14.6 (+9%) | 17.6 → 17.1 (-3%) | 26.8 → 22.7 (-15%) | 48.1 → 31.4 (-35%) | 94.5 → 48.3 (-49%) | 172.1 → 79.2 (-54%) | 337.8 → 145.8 (-57%) | 671.6 → 289.3 (-57%) | 1.3k → 538.8 (-58%) | 12.5k → 5.1k (-59%) | 119.9k → 50.6k (-58%) |
| keep random 50%, contiguous | 8.1 → 10.0 (+23%) | 12.7 → 12.0 (-5%) | 20.4 → 18.6 (-9%) | 36.4 → 31.4 (-14%) | 72.1 → 55.6 (-23%) | 142.7 → 103.2 (-28%) | 282.5 → 199.2 (-29%) | 554.9 → 399.3 (-28%) | 1.1k → 776.9 (-27%) | 29.1k → 7.9k (-73%) | 485.5k → 353.4k (-27%) |
| keep random 50%, wrapped | 11.1 → 11.8 (+6%) | 15.8 → 15.7 (-1%) | 23.4 → 24.5 (+5%) | 40.9 → 40.4 (-1%) | 78.7 → 66.6 (-15%) | 155.2 → 115.6 (-25%) | 311.4 → 218.2 (-30%) | 603.4 → 421.3 (-30%) | 1.1k → 789.8 (-31%) | 26.1k → 7.8k (-70%) | 480.3k → 353.1k (-26%) |

</details>
…e_no_reborrowed_field, r=Dnreikronos

borrowck: Fix Reborrow ICE on types with several lifetimes

Fixes rust-lang#165653

The ICE comes from borrowck. When a Reborrow type has no field that actually gets reborrowed (no `&mut` and no other Reborrow type inside), borrowck borrows the whole value instead, and that code just assumed the type has one lifetime. Reborrow types can have more than one lifetime now, so something like the struct with `&'a &'b str` from the issue blew up right there.

The fix is in that fallback. When nothing gets reborrowed, borrowck now borrows the whole value once for each lifetime of the target type instead of panicking. With one lifetime it does exactly what it did before. With more it keeps the value borrowed while any of them is still alive, so two live reborrows of a two lifetime marker still get the usual "borrowed as mutable more than once" error, and using them one after the other is fine, same as with one lifetime. The program from the issue now gets the same error its one lifetime version already gets, since it's reborrowing through a shared ref.

I ran a bunch of programs against a recent nightly. Nothing that compiles there stops compiling, the crashes are gone (generic fields, associated type fields, fields that are only Copy in some functions, CoerceShared targets with more lifetimes than the source all hit the same spot), and the ones that error now get the same error as their one lifetime version. Two things I didn't touch are the `&'static mut` field ICE (rust-lang#164933) and a CoerceShared panic when the source and target PhantomData fields don't match, that one also happens with one lifetime so it's a different bug.

Honestly I think borrowing under every lifetime is the safe choice but maybe not the smartest one, a smarter version could work out which lifetime really matters for each field. If someone who knows the Reborrow design better has an opinion on that I'm happy to change it.
…thercote

traits: Fix dead match arm for String type suggestions.

The existing arm was trying to match with a diagnostic named "String", which doesn't exist and was dead code that never actually matched any case.

Replace and fix the match condition by matching the definition id with the `String` `LangItem` instead as `String` exists as a LangItem and not a diagnostic item.

closes rust-lang#166392
…12, r=adwinwhite

Add regression test for rust-lang#151312

Adds a regression test for rust-lang#151312.

The ICE (`cannot relate bound region` in `point_at_chain`) was fixed by
rust-lang#158536, which instantiates the binder instead of using `skip_binder` when
building the suggestion. That PR only added a test for rust-lang#158317, which is a
different example, so this case wasn't covered yet.

The test ICEs on nightly-2026-07-01 and only reports E0271 on current master.
I also tried a few variations of the example (free fn, associated fn, closure,
two arguments, nested references) and none of them ICE now.

Closes rust-lang#151312

r? @lcnr

### LLM disclosure
The task itself came from the issue (find the fixing PR and add a test).
I used an LLM to run the bisect, compare the example with the test from
rust-lang#158536, and to help write the test and draft some texts. I reviewed the
test and the results myself, so I understand the change.
…ouxu

compiletest: Further clean up directive parsing

See individual commits for details. Follow-up to rust-lang#165576 and rust-lang#165483.

Fixes rust-lang#123765.

r? jieyouxu

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
…args, r=ZuseZ4

autodiff: don't ICE on invalid macro arguments

Fixes rust-lang#150326
Fixes rust-lang#150327
Fixes rust-lang#150329
Fixes rust-lang#160329

The generated function name must now be a single identifier. Activities that aren't identifiers get the existing "did not recognize Activity" error. A function with a return type but no activities gets the existing activity count error, and expansion stops there.

In rust-lang#160329, parser recovery leaves the function with more parameters than activities. That case now stops at the count error, so its crash test moves to `tests/ui/autodiff`.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Nov 26, 2026
@rustbot rustbot added A-box Area: Our favorite opsem complication A-collections Area: `std::collections` (prefer A-binaryheap, A-btree, A-hashtable, A-linkedlist, A-vecdeque) labels Nov 26, 2026
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-slice-vec Area: `[T]` and `Vec<T>` A-testsuite Area: The testsuite used to check the correctness of rustc A-vecdeque Area: `std::collections::VecDeque` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Nov 26, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r+ p=5 force

Trying commonly failed jobs
@bors try jobs=dist-various-1,dist-various-2,test-various,test-x86_64-gnu-aux,test-x86_64-msvc-1,test-aarch64-apple-1,test-aarch64-apple-2,test-x86_64-mingw-1,test-i686-msvc,test-armhf-gnu,test-x86_64-gnu-llvm-22-3,test-aarch64-msvc-2

@rust-bors

rust-bors Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 25efe2c has been approved by JonathanBrouwer

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 Nov 26, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 26, 2026
Rollup of 7 pull requests


try-job: dist-various-1
try-job: dist-various-2
try-job: test-various
try-job: test-x86_64-gnu-aux
try-job: test-x86_64-msvc-1
try-job: test-aarch64-apple-1
try-job: test-aarch64-apple-2
try-job: test-x86_64-mingw-1
try-job: test-i686-msvc
try-job: test-armhf-gnu
try-job: test-x86_64-gnu-llvm-22-3
try-job: test-aarch64-msvc-2
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 26, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #164252 (Share retain implementation between Vec and VecDeque)
 - #166171 (borrowck: Fix Reborrow ICE on types with several lifetimes)
 - #166506 (traits: Fix dead match arm for String type suggestions.)
 - #164542 (Add regression test for #151312)
 - #165651 (compiletest: Further clean up directive parsing)
 - #166196 (autodiff: don't ICE on invalid macro arguments)
 - #166556 (remove `Box::into_boxed_slice`)
@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 26, 2026
@rust-bors

rust-bors Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for ef3cc55 failed: CI. Failed job:

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-various failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [ui] tests/ui/abi/stack-probes.rs#x64 stdout ----

error in revision `x64`: test did not exit with success! code=Some(101) so test would pass with `run-fail`
status: exit status: 101
command: cd "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/stack-probes.x64" && LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-musl/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/stack-probes.x64/auxiliary:/checkout/obj/build/x86_64-unknown-linux-gnu/bootstrap-tools/x86_64-unknown-linux-gnu/release/build/run_make_support/f48a402713b67034/out" RUST_TEST_THREADS="4" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/stack-probes.x64/a"
--- stdout -------------------------------
status: signal: 11 (SIGSEGV) (core dumped)
stdout: 
stderr:
------------------------------------------
--- stderr -------------------------------

thread 'main' (333221) panicked at /checkout/tests/ui/abi/stack-probes.rs:86:5:
assertion failed: stderr.contains("has overflowed its stack\n")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
------------------------------------------

---- [ui] tests/ui/abi/stack-probes.rs#x64 stdout end ----
---- [ui] tests/ui/runtime/out-of-stack.rs stdout ----

error: test did not exit with success! code=Some(101) so test would pass with `run-fail`
status: exit status: 101
command: cd "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/runtime/out-of-stack" && LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-musl/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/runtime/out-of-stack/auxiliary:/checkout/obj/build/x86_64-unknown-linux-gnu/bootstrap-tools/x86_64-unknown-linux-gnu/release/build/run_make_support/f48a402713b67034/out" RUST_TEST_THREADS="4" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/runtime/out-of-stack/a"
--- stdout -------------------------------
testing: silent-thread
------------------------------------------
--- stderr -------------------------------

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 26, 2026
@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 26, 2026
@rust-bors

rust-bors Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

@rust-bors

rust-bors Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 2279db9 (2279db9c419c2c6fbf1eb607615730b2acd122e0)
Base parent: 6c709eb (6c709eb428d472a3c3d93681c1ba37d44a1c27cf)

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

Labels

A-box Area: Our favorite opsem complication A-collections Area: `std::collections` (prefer A-binaryheap, A-btree, A-hashtable, A-linkedlist, A-vecdeque) A-compiletest Area: The compiletest test runner A-slice-vec Area: `[T]` and `Vec<T>` A-testsuite Area: The testsuite used to check the correctness of rustc A-vecdeque Area: `std::collections::VecDeque` rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants