Skip to content

Support const generics for builtin derive macro #13463

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

Merged
merged 1 commit into from
Oct 22, 2022

Conversation

lowr
Copy link
Contributor

@lowr lowr commented Oct 22, 2022

Fixes #13121

We have been treating every generic parameter as type parameter during builtin derive macro expansion. This patch adds support for const generics in such expansions.

@lowr
Copy link
Contributor Author

lowr commented Oct 22, 2022

While this patch suppresses the error shown in the original issue, hovering over the == token still shows fn eq(&self, v: &u16) -> bool. That's a different issue and I intend to work on that too.

@Veykril
Copy link
Member

Veykril commented Oct 22, 2022

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Oct 22, 2022

📌 Commit f550114 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Oct 22, 2022

⌛ Testing commit f550114 with merge 2987cb2...

bors added a commit that referenced this pull request Oct 22, 2022
…=Veykril

Support const generics for builtin derive macro

Fixes #13121

We have been treating every generic parameter as type parameter during builtin derive macro expansion. This patch adds support for const generics in such expansions.
@lowr lowr force-pushed the fix/builtin-derive-with-const-generics branch from f550114 to 6459d7f Compare October 22, 2022 15:06
@lowr
Copy link
Contributor Author

lowr commented Oct 22, 2022

@Veykril Sorry I've pushed with a small tweak, could you r+ again the new commit?

@Veykril
Copy link
Member

Veykril commented Oct 22, 2022

sure :)
@bors r+

@bors
Copy link
Contributor

bors commented Oct 22, 2022

📌 Commit 6459d7f has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Oct 22, 2022

⌛ Testing commit 6459d7f with merge 19efa0b...

@bors
Copy link
Contributor

bors commented Oct 22, 2022

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 19efa0b to master...

@bors bors merged commit 19efa0b into rust-lang:master Oct 22, 2022
bors added a commit that referenced this pull request Oct 24, 2022
fix: Test all type args for trait when finding matching impl

Addresses #13463 (comment)

When finding matching impl for a trait method, we've been testing the unifiability of self type. However, there can be multiple impl of a trait for the same type with different generic arguments for the trait. This patch takes it into account and tests the unifiability of all type arguments for the trait (the first being the self type) thus enables rust-analyzer to find the correct impl even in such cases.
bors added a commit that referenced this pull request Oct 26, 2022
…ebold

fix: Test all generic args for trait when finding matching impl

Addresses #13463 (comment)

When finding matching impl for a trait method, we've been testing the unifiability of self type. However, there can be multiple impl of a trait for the same type with different generic arguments for the trait. This patch takes it into account and tests the unifiability of all type arguments for the trait (the first being the self type) thus enables rust-analyzer to find the correct impl even in such cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Derived PartialEq not recognized for const-generic type when other PartialEq is present (type-mismatch)
3 participants