Open cjgillot opened 2 years ago
@rustbot claim
Is anyone working on this? If not I would like to take a look
The tasks are interlinked, from my understanding, and the version that I have has one, two, and three almost done and I stopped at the last item. In fact, I am stuck there, give me like a week or two so I refresh my memory and get an exact idea about what's blocking me on that last item?
impl-trait
can either be desugared as a generic parameter (universal), as an opaque type (existential), or forbidden. This desugaring is currently on the AST in two places:def_collector
andast_lowering
. The two logic are not consistent with one another. When this happens,ast_lowering
is right.dyn Trait<T: Bound>
sometimes desugars todyn Trait<T = impl Bound>
, and sometimes does not.We should only determine the desugaring once. This can be achieved by:
def_collector
into animpl_trait_context: FxHashMap<LocalDefId, ImplTraitContext>
inResolver
;impl_trait_id: NodeId
inrustc_ast::AssocConstraint
and use it to create the impl-trait'sLocalDefId
;UniversalInDyn
to handle thedyn Trait<T: Bound>
case indef_collector
and create the definition there,desugar_to_impl_trait
should be replaced byresolver.opt_local_def_id(constraint.impl_trait_id).is_some()
;&mut Vec
inrustc_ast_lowering::ImplTraitContext
toLoweringContext
, the new field should be saved and restored bywith_hir_id_owner
;rustc_ast_lowering::ImplTraitContext
andrustc_resolve::ImplTraitContext
, introducing aResolverAstLowering::get_impl_trait_context(LocalDefId) -> Option<ImplTraitContext>
to access the information.Please reach out on Zulip for any question.