Skip to content
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

Implement use associated items of traits #134754

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

Conversation

frank-king
Copy link
Contributor

This PR implements #134691.

@rustbot
Copy link
Collaborator

rustbot commented Dec 25, 2024

r? @oli-obk

rustbot has assigned @oli-obk.
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 Dec 25, 2024
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

cc @petrochenkov as this PR has some non-trivial resolve changes.

@frank-king frank-king force-pushed the feature/import_trait_associated_functions branch from dc2bdee to 6905a19 Compare December 25, 2024 08:20
@petrochenkov petrochenkov self-assigned this Dec 25, 2024
@rust-log-analyzer

This comment has been minimized.

@frank-king frank-king force-pushed the feature/import_trait_associated_functions branch from 6905a19 to 8606eb3 Compare December 25, 2024 15:11
@frank-king frank-king force-pushed the feature/import_trait_associated_functions branch from 8606eb3 to 72bc889 Compare December 25, 2024 15:16
Comment on lines -831 to +836
Ok(binding) if binding.is_importable() => {
Ok(binding)
if binding.is_importable()
|| binding.is_assoc_const_or_fn()
&& this.tcx.features().import_trait_associated_functions() =>
{
Copy link
Contributor

Choose a reason for hiding this comment

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

I think is_importable should just stop rejecting assoc const and fn. Instead, within this match arm, emit the feature error unconditionally if it is either of those two (and the feature wasn't enabled). That's how we handle feature gating where possible/feasible: just go through as if the feature gate was already enabled, but emit an error if it wasn't.

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.

7 participants