HIR ty lowering: Clean up & refactor the lowering of type-relative paths #140218
+626
−518
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.
While rebasing #126651 I realized that HIR ty lowering could benefit from some spring cleaning now that it's been extended to handle RTN and mGCA paths.
More seriously, similar to my merged PR #118668 which unified the handling of all associated item constraints (assoc ty, const (ACE) & fn (RTN)), this PR (commit 695fcf5) partially1 deduplicates the resolution code for all type-relative paths (assoc ty, const (mGCA) & fn (RTN)).
Why? DRY'ing that part of the code means PR #126651 will automatically support RTN paths like
Ty::AssocTy::assoc_fn(..)
and it also implies shared diagnostic code and thus better diagnostics for RTN.The other commits represent cleanups, renamings, moves. More notably, I've renamed path lowering methods to be a lot more descriptive, so ones lowering
QPath(Resolved)
paths now have_resolved_
in their name and ones loweringQPath(TypeRelative)
paths now have_type_relative_
in their name. This should make it stupidly obvious what their purpose is.Best reviewed commit by commit. The changes are close to trivial but the diff might make it look hairier.
r? compiler-errors
Footnotes
Sadly, I couldn't unify as much compared to the other PR without introducing unnecessary
unreachable!()
s or rendering the code otherwise illegible with flags and micro helper traits. ↩