# Trait alias work-plan and architecture overview ## RFC #3437 [Link to RFC](https://github.com/Jules-Bertholet/rfcs/blob/implementable-trait-alias/text/3437-implementable-trait-alias.md) The following work summary is extracted and predicted from the RFC text. The items are ordered by descending priority and potential for a quick prototype - Syntactical support from `rustc_ast`, `rustc_hir` and `rustc_ast_lowering` - [ ] Change the parser rule to try the `path` NV first - Name resolution - ~~`rustc_resolve` needs a new phase in the late resolver, because it needs to wait for `SupertraitItem` to register before it can resolve `type SubtraitItem = Vec<Self::SupertraitItem>`.~~ - *This is a shared work* with Pre-RFCing `impl Subtrait` - Two steps for this quest - [x] Handle the simple case: simple `Ident` as item names, resolve them against the - [ ] :construction: Handle the slightly harder case: item names as paths, resolve them while skipping the generics, e.g. `fn Qualified::<A, B>::name() ...` should only be resolved against `Qualified<...>` - HIR book-keeping - This can start *independently* to avoid the syntax bikeshedding - For each conceptual trait alias items, we will record the supertraits, the associated items and method bodies - Modify the queries - `associated_item_def_ids` because it assumes that all associated items in a `trait`-def block are owned by the principal trait definition, and we are going to break this assumption with implementable trait alias - was noch? - Crate level book-keeping - [x] Propagate supertrait `DefId`s across crate boundary - [x] Propagate supertrait bounds with generics across crate boundary - Trait solver - This is the heavy lifting, and I presume that the foundation is already there. - [ ] Handle the simple case: items without generics - [ ] :construction: Modify the crate-level trait-impl collector to re-route the supertrait items into their right trait bins to simulate `impl` - [ ] :construction: Modify the coherence check to enforce the rule in which either no impl items or all impl items should be present for any non-marker supertraits - [ ] :dragon:s ? surprises? secret side-quests? ## `impl Subtrait` for Supertrait items - First one needs to promote the Pre-RFC text to a formal RFC and @dingxf will take care of it - ... so that we can have a RFC number to refer to at least ## PRs and Issues - [ ] [#143527](https://github.com/rust-lang/rust/issues/143527) resolver, maybe the necessary HIR changes so that we have a minimal UI test case to check into the compiler