Commit 406b200
authored
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`1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
746 | | - | |
747 | | - | |
748 | | - | |
| 746 | + | |
749 | 747 | | |
| 748 | + | |
| 749 | + | |
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
| |||
0 commit comments