Skip to content

[Draft] Supertrait item resolution in subtrait impls #143527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dingxiangfei2009
Copy link
Contributor

r? @ghost

cc @cramertj @petrochenkov

This is pertaining to implementable trait aliases, Deref/Receiver trait migration and supertrait items in subtrait impls.

This is a draft for the resolver and crate metadata changes. Through this patch, the resolver will pick up supertrait items, collected from the trait super-bounds and trait alias in a future extension. This information will be encoded so that the resolver can resolve names in the downstream crates.

I would like to post this draft earlier because there are already significant design changes, which may warrant collecting opinions ahead of time.

Next steps would be

  • teach hir-analysis to collect associated items in subtrait items into implied supertrait impls;
  • adapt the syntax so that associated items can be paths instead of just identifies today, because associate items on paths is essential for the disambiguation of the design.

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jul 6, 2025
@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
-    fn get_module_supertraits(self, id: DefIndex, sess: &'a Session) -> impl Iterator<Item = DefId> {
+    fn get_module_supertraits(
+        self,
+        id: DefIndex,
+        sess: &'a Session,
+    ) -> impl Iterator<Item = DefId> {
         let supertraits = self.root.tables.module_supertraits.get(self, id);
         supertraits.decode((self, sess)).into_iter()
     }
fmt: checked 6147 files
Build completed unsuccessfully in 0:00:44
  local time: Sun Jul  6 14:09:05 UTC 2025
  network time: Sun, 06 Jul 2025 14:09:06 GMT

@petrochenkov petrochenkov self-assigned this Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants