Simplify universal impl-trait collection during lowering #96644
Labels
A-HIR
Area: The high-level intermediate representation (HIR)
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
During lowering (
rustc_ast_lowering
), universal impl-trait are desugared to extra generic parameters to the current item, and their bounds added to the where clause.becomes
This is done by carrying two vectors inside
ImplTraitContext::Universal
.These vectors are only created by
add_implicit_generics
method, and references to them are passed around.We should prefer having them as fields in
LoweringContext
.Instructions:
ImplTraitContext::Universal
to field inLoweringContext
;with_hir_id_owner
, and assert that the value after the call tof
is empty;itctx: ImplTraitContext
parameter toadd_implicit_generics
and assert that these fields are empty on return ifitctxt
is notUniversal
;lower_generics
by calls toadd_implicit_generics
;add_implicit_generics
tolower_generics
;lower_generics_mut
intolower_generics
(if this simplifies the logic, not sure).Please contact me on zulip for any question.
The text was updated successfully, but these errors were encountered: