Skip to content

Rollup of 4 pull requests - #166580

Closed
clarfonthey wants to merge 19 commits into
rust-lang:mainfrom
clarfonthey:rollup-xf2quoT
Closed

clarfonthey wants to merge 19 commits into
rust-lang:mainfrom
clarfonthey:rollup-xf2quoT

Conversation

@clarfonthey

Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

SleighPenguin22 and others added 19 commits November 25, 2026 14:18
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`).
…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.
…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
@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-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc 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. labels Nov 26, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor 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 41cd6c2 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 26, 2026
@rust-bors rust-bors Bot 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 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

⌛ Trying commit 41cd6c2 with merge 0cf4627…

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/45745439718

rust-bors Bot pushed a commit that referenced this pull request Nov 26, 2026
Rollup of 4 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
Rollup of 4 pull requests

Successful merges:

 - #166171 (borrowck: Fix Reborrow ICE on types with several lifetimes)
 - #165651 (compiletest: Further clean up directive parsing)
 - #166196 (autodiff: don't ICE on invalid macro arguments)
 - #166556 (remove `Box::into_boxed_slice`)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job dist-x86_64-mingw failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.469
error: could not compile `either` (lib)

Caused by:
  process didn't exit successfully: `D:\a\rust\rust\build\bootstrap\debug\rustc D:\a\rust\rust\build\bootstrap\debug\rustc --crate-name either --edition=2021 C:\Users\runneradmin\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\either-1.16.0\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat,unused-externs-silent --crate-type lib --emit=dep-info,metadata,link -Z embed-metadata=no -C opt-level=3 -C embed-bitcode=no --remap-path-scope=all --remap-path-prefix=C:\Users\runneradmin\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f=/cargo/registry/25cdd57fae9f0462 --remap-path-prefix=D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage2-tools=/cargo/build-dir --remap-path-prefix=D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage1\lib\rustlib\src\rust=/rustc/679caf773ea068d56cd55e110ccece22d7a2ddec --cfg "feature=\"default\"" --cfg "feature=\"std\"" --cfg "feature=\"use_std\"" --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values(\"default\", \"serde\", \"std\", \"use_std\"))" -C metadata=b266ee6f8fd95f74 -C extra-filename=-15bca8c83485b993 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage2-tools\x86_64-pc-windows-gnu\release\build\either/15bca8c83485b993\out --target x86_64-pc-windows-gnu -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-gnu\stage2-tools\release\build\either/15bca8c83485b993\out --cap-lints allow --cfg=windows_raw_dylib -Zannotate-moves -Zunstable-options --check-cfg=cfg(bootstrap) --check-cfg=cfg(rust_analyzer) -Zmacro-backtrace -Csplit-debuginfo=off -Clink-arg=-LD:/a/rust/rust/build/x86_64-pc-windows-gnu/llvm/lib -Alinker-messages -Zunstable-options -Z binary-dep-depinfo --force-warn=unused_crate_dependencies` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] build_script_build test:false 0.507
[RUSTC-TIMING] autocfg test:false 0.516
Bootstrap failed while executing `dist bootstrap --include-default-paths`
Currently active steps:

@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 679caf7 failed: CI. Failed job:

@clarfonthey

Copy link
Copy Markdown
Contributor Author

@bors try cancel

@rust-bors

rust-bors Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Try build cancelled. Cancelled workflows:

Hint: if you want to run another try build, you do not need to manually cancel the previous one. Just run @bors try and bors will cancel the previous build automatically.

@JonathanBrouwer

Copy link
Copy Markdown
Member

Probably spurious

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

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

@clarfonthey
clarfonthey deleted the rollup-xf2quoT branch November 26, 2026 11:36
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-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants