Skip to content

resolve: Support imports of associated types and glob imports from traits #138712

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

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

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Mar 19, 2025

Follow up to #134754, part of #134691.
This PR also closes #138711 now.

Prohibiting use Trait::AssocType; at name resolution stage doesn't make sense, the name itself is perfectly resolveable.
It's a type checker's problem that the necessary generic args are not passed when the imported AssocType is used, so an error should be reported there.

And since we can import associated trait items now, glob imports from traits can also be allowed.

@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2025

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2025

HIR ty lowering was modified

cc @fmease

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors

This comment was marked as resolved.

@fmease fmease assigned fmease and unassigned wesleywiser Apr 7, 2025
Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with lifting the restrictions from the resolver and with making HIR ty lowering responsible for dealing with it, although this PR would allow more code to compile under the unstable feature (trait T { type A; } use T::A; would start compiling (notice the lack of any use sites of A!)) plus glob imports, of course.

This deviates from the RFC. IIRC it's fine for me as a T-compiler member to approve such a change regardless and without T-lang input as long as we clearly state all of this in the tracking issue #134691, so any hypothetical future stabilization report and T-lang stabilization FCP can pick up on it.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 8, 2025
@petrochenkov
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

import_trait_associated_functions is not very compatible with min_generic_const_args
7 participants