-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
assert impossible branch is impossible #150031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+3
−3
Conversation
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
42ecd46 to
72c84a6
Compare
Contributor
|
@bors r+ rollup |
Collaborator
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Dec 16, 2025
…r=petrochenkov assert impossible branch is impossible The second half of this boolean or expression should not be possible with the current visitation implementation. Reasoning: - Innermost res will always be the first candidate visited. - the first scopes visited are `derive_helper` candidates, followed by a single step at `derive_helper_compat`: https://github.com/rust-lang/rust/blob/ee447067/compiler/rustc_resolve/src/ident.rs#L180-L192 - if there are candidates for both kinds the derive_helper candidate will always be innermost - there can only be one derive_helper_compat candidate - The first branch handles cases where the first candidate is a `derive_helper_compat` - if the first candidate is not a `derive_helper_compat` (as enforced by the first branch) and it is not a `derive_helper` (as enforced by the end of the second boolean expression) then then the first candidate and all subsequent candidates must be from later scope types, res cannot possibly be a `derive_helper_compat` r? `@petrochenkov`
bors
added a commit
that referenced
this pull request
Dec 16, 2025
Rollup of 14 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149771 (bootstrap readme: make easy to read when editor wrapping is not enabled) - #149856 (Provide an extended framework for type visit, for use in rust-analyzer) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) - #150022 (Generate macro expansion for rust compiler crates docs) - #150029 (Update books) - #150031 (assert impossible branch is impossible) - #150034 (do not add `I-prioritize` when `F-*` labels are present) - #150036 (Use the embeddable filename for coverage artifacts) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Dec 16, 2025
Rollup of 13 pull requests Successful merges: - #148756 (Warn on codegen attributes on required trait methods) - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf) - #149271 (feat: dlopen Enzyme) - #149459 (std: sys: fs: uefi: Implement set_times and set_perm) - #149771 (bootstrap readme: make easy to read when editor wrapping is not enabled) - #149856 (Provide an extended framework for type visit, for use in rust-analyzer) - #149950 (Simplify how inline asm handles `MaybeUninit`) - #150014 (Metadata loader cleanups) - #150021 (document that mpmc channels deliver an item to (at most) one receiver) - #150029 (Update books) - #150031 (assert impossible branch is impossible) - #150034 (do not add `I-prioritize` when `F-*` labels are present) - #150036 (Use the embeddable filename for coverage artifacts) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Dec 16, 2025
Rollup merge of #150031 - yaahc:derive-helper-ambig-assert, r=petrochenkov assert impossible branch is impossible The second half of this boolean or expression should not be possible with the current visitation implementation. Reasoning: - Innermost res will always be the first candidate visited. - the first scopes visited are `derive_helper` candidates, followed by a single step at `derive_helper_compat`: https://github.com/rust-lang/rust/blob/ee447067/compiler/rustc_resolve/src/ident.rs#L180-L192 - if there are candidates for both kinds the derive_helper candidate will always be innermost - there can only be one derive_helper_compat candidate - The first branch handles cases where the first candidate is a `derive_helper_compat` - if the first candidate is not a `derive_helper_compat` (as enforced by the first branch) and it is not a `derive_helper` (as enforced by the end of the second boolean expression) then then the first candidate and all subsequent candidates must be from later scope types, res cannot possibly be a `derive_helper_compat` r? ``@petrochenkov``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-resolve
Area: Name/path resolution done by `rustc_resolve` specifically
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
The second half of this boolean or expression should not be possible with the current visitation implementation.
Reasoning:
derive_helpercandidates, followed by a single step atderive_helper_compat: https://github.com/rust-lang/rust/blob/ee447067/compiler/rustc_resolve/src/ident.rs#L180-L192derive_helper_compatderive_helper_compat(as enforced by the first branch) and it is not aderive_helper(as enforced by the end of the second boolean expression) then then the first candidate and all subsequent candidates must be from later scope types, res cannot possibly be aderive_helper_compatr? @petrochenkov