Skip to content

Remove type-traversal trait aliases#108340

Merged
bors merged 2 commits intorust-lang:masterfrom
eggyal:remove_traversal_trait_aliases
Feb 22, 2023
Merged

Remove type-traversal trait aliases#108340
bors merged 2 commits intorust-lang:masterfrom
eggyal:remove_traversal_trait_aliases

Conversation

@eggyal
Copy link
Copy Markdown
Contributor

@eggyal eggyal commented Feb 22, 2023

#107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in rustc_middle to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value.

Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent r-a has become useless topic on the #t-compiler/help Zulip stream).

This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by TyCtxt<'tcx> rather than just the 'tcx lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329.

Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up.

r? @oli-obk

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants