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

Suggest to replace tuple constructor through projection #135090

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

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jan 4, 2025

See the code example. when Self::Assoc normalizes to a struct that has a tuple constructor, you cannot construct the type via Self::Assoc(field, field). Instead, suggest to replace it with the correct named struct.

Fixes #120871

@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
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 Jan 4, 2025
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks! One test comment, but otherwise looks good.

Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: maybe also //@ run-rustfix since the suggestion is machine-applicable?

@jieyouxu jieyouxu assigned jieyouxu and unassigned davidtwco Jan 5, 2025
@jieyouxu jieyouxu 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 Jan 5, 2025
@lqd
Copy link
Member

lqd commented Jan 5, 2025

(I was also already reviewing it lmao)

This LGTM, so feel free to r=me. I do have a question though: do you think it'd be worthwhile to support tuples in the same manner? (If so, I can take a look at that, no need to do this in this PR at all).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Unable to find assoc type when using tuple create syntax Self::AssocType(...)
5 participants