Repository navigation
reborrow: Fix various ICEs related to auto reborrowing of user-space types - #163769
Merged
rust-bors[bot] merged 10 commits intoOct 25, 2026
Merged
Conversation
Collaborator
|
This PR changes a file inside |
Collaborator
|
r? @Walnut356 rustbot has assigned @Walnut356. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
|
That makes sense, and the code changes look alright. Just in case, cc @aapoalas |
Walnut356
approved these changes
Oct 25, 2026
Contributor
|
I apologize for the delay @bors r+ |
Contributor
aapoalas
approved these changes
Oct 25, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 25, 2026
…uwer Rollup of 20 pull requests Successful merges: - #160404 (fd-views: AsRef<File>&Co. for BorrowedFd) - #161362 ( rustdoc: Correctly handle reexports when --document-private-items is used) - #163769 (reborrow: Fix various ICEs related to auto reborrowing of user-space types) - #164764 (Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures) - #164860 (std::fs: read interrupted by a signal, read_buf_exact_at reports EOF.) - #164869 (rustc_codegen_gcc subtree update) - #157123 (library: optimize truncate method) - #159916 (Optimize `str.escape_default().to_string()`) - #163510 (process: Improve the output of `Debug` for `ExitStatus` on Unix) - #164508 (ping me for layout invariant changes) - #164758 (Update dependency jinja2 to v3.1.6 [SECURITY]) - #164816 (Take the colon span into account for struct field initializers) - #164836 (Add regression test for #162109) - #164846 (Remove contradictory inequalities from overflow safety docs) - #164857 (Do not checkout Cargo for bootstrap tests) - #164868 (Fix skipping library build with `--keep-stage[-std]`) - #164872 (cg_llvm: clarify Send / Sync story for modules) - #164880 (Add context span showing item that can't be annotated) - #164881 (Add FIXME comments to `from_ascii_bytes_radix_impl`) - #164884 (Windows: bounds-check the reparse point name in `read_link`)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 25, 2026
…uwer Rollup of 20 pull requests Successful merges: - #160404 (fd-views: AsRef<File>&Co. for BorrowedFd) - #161362 ( rustdoc: Correctly handle reexports when --document-private-items is used) - #163769 (reborrow: Fix various ICEs related to auto reborrowing of user-space types) - #164764 (Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures) - #164860 (std::fs: read interrupted by a signal, read_buf_exact_at reports EOF.) - #164869 (rustc_codegen_gcc subtree update) - #157123 (library: optimize truncate method) - #159916 (Optimize `str.escape_default().to_string()`) - #163510 (process: Improve the output of `Debug` for `ExitStatus` on Unix) - #164508 (ping me for layout invariant changes) - #164758 (Update dependency jinja2 to v3.1.6 [SECURITY]) - #164816 (Take the colon span into account for struct field initializers) - #164836 (Add regression test for #162109) - #164846 (Remove contradictory inequalities from overflow safety docs) - #164857 (Do not checkout Cargo for bootstrap tests) - #164868 (Fix skipping library build with `--keep-stage[-std]`) - #164872 (cg_llvm: clarify Send / Sync story for modules) - #164880 (Add context span showing item that can't be annotated) - #164881 (Add FIXME comments to `from_ascii_bytes_radix_impl`) - #164884 (Windows: bounds-check the reparse point name in `read_link`)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 25, 2026
Rollup merge of #163769 - jakubadamw:fix-various-reborrow-ices, r=Walnut356 reborrow: Fix various ICEs related to auto reborrowing of user-space types I appreciate the feature is a lang experiment, but it probably won’t hurt to get rid of these ICEs if the fix is relatively striaghtforward. And so this PR fixes several ICEs with `#![feature(reborrow)]`. Most of them happen when a `Reborrow` or `CoerceShared` impl is wrong. Coherence reports an error for the impl, but typeck still lets code reborrow through it. Then borrowck (or const eval) crashes, because the implementation isn't the shape it expects. Fix: when a reborrow coercion goes through, check whether coherence had already rejected any `Reborrow`/`CoerceShared` impl. If it did, taint the body so that borrowck and const evaluation skip it. Related tracking issue: #145612 Note: invalid reborrows that only come from a `where` clause still ICE – that still needs a fix. Tests: one test per issue closed, using the code from the issues’ contents. #162108's code no longer reproduces as posted, however, so its test uses a slightly smaller version that hits the same ICE. I also moved the reborrow crashes/ tests that don't crash any more into tests/ui/reborrow. **LLM disclosure**: I used Claude Opus 5.5 to research the common denominator between the issues and come up with the solution that turns these ICEs into graceful compile-time errors. It also extracted the tests from the issues and extended them with the right error annotations, but I subsequenty verified them manually against the issues. Closes #156307. Closes #156308. Closes #156311. Closes #156315. Closes #158149. Closes #162108. Closes #162141. Closes #162142.
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.
I appreciate the feature is a lang experiment, but it probably won’t hurt to get rid of these ICEs if the fix is relatively striaghtforward. And so this PR fixes several ICEs with
#![feature(reborrow)]. Most of them happen when aReborroworCoerceSharedimpl is wrong. Coherence reports an error for the impl, but typeck still lets code reborrow through it. Then borrowck (or const eval) crashes, because the implementation isn't the shape it expects. Fix: when a reborrow coercion goes through, check whether coherence had already rejected anyReborrow/CoerceSharedimpl. If it did, taint the body so that borrowck and const evaluation skip it.Related tracking issue: #145612
Note: invalid reborrows that only come from a
whereclause still ICE – that still needs a fix.Tests: one test per issue closed, using the code from the issues’ contents. #162108's code no longer reproduces as posted, however, so its test uses a slightly smaller version that hits the same ICE. I also moved the reborrow crashes/ tests that don't crash any more into tests/ui/reborrow.
LLM disclosure: I used Claude Opus 5.5 to research the common denominator between the issues and come up with the solution that turns these ICEs into graceful compile-time errors. It also extracted the tests from the issues and extended them with the right error annotations, but I subsequenty verified them manually against the issues.
Closes #156307.
Closes #156308.
Closes #156311.
Closes #156315.
Closes #158149.
Closes #162108.
Closes #162141.
Closes #162142.