Repository navigation
Rollup of 7 pull requests - #166582
Closed
JonathanBrouwer wants to merge 27 commits into
Closed
Rollup of 7 pull requests#166582JonathanBrouwer wants to merge 27 commits into
JonathanBrouwer wants to merge 27 commits into
Conversation
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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V7Zq35jCLdvPJALTSkLPEC
And stop accepting empty directive names & empty values (after the `:`).
…vision conditions
* 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`.
…xed-slice, r=clarfonthey remove `Box::into_boxed_slice` This removes the implementation of `Box::into_boxed_slice` as discussed in https://github.com/issues/recent?issue=rust-lang%7Crust%7C71582&issue_global_id=MDU6SXNzdWU2MDcwMDMxNzc%3D
Member
Author
Contributor
This comment has been minimized.
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
This comment has been minimized.
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`)
Contributor
|
💔 Test for ef3cc55 failed: CI. Failed job:
|
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
This pull request was unapproved due to being closed. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
cannot relate bound region#151312)Box::into_boxed_slice#166556 (removeBox::into_boxed_slice)r? @ghost
Create a similar rollup