Skip to content

don't generate extra impl for Eq assertions #128

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: main
Choose a base branch
from

Conversation

fee1-dead
Copy link

Eq already has a method assert_receiver_is_total_eq that allows you to put asserts in. This PR makes it so we use that instead of generating a new trait and impl every time (which could be a lot).

This is also a cleanup because apparently additional_impl is only used by Eq (and arguably quite confusing as additional_impl is used to generate the Eq impl while the "main" impl was the extra impl) so we can remove that now.

generating a struct __AssertEq each time is still a little wasteful, but given that derive-where is a single crate (so no "normal" support crate to share types) it might be unavoidable.

Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…r, r=jieyouxu

some `derive_more` refactors

some clauses can be merged together without requiring an attribute for each trait derived.

also manually impl `Eq` because the `derive_where` generated code is too much for my comfort (cc ModProg/derive-where#128)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…r, r=jieyouxu

some `derive_more` refactors

some clauses can be merged together without requiring an attribute for each trait derived.

also manually impl `Eq` because the `derive_where` generated code is too much for my comfort (cc ModProg/derive-where#128)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…r, r=jieyouxu

some `derive_more` refactors

some clauses can be merged together without requiring an attribute for each trait derived.

also manually impl `Eq` because the `derive_where` generated code is too much for my comfort (cc ModProg/derive-where#128)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…r, r=jieyouxu

some `derive_more` refactors

some clauses can be merged together without requiring an attribute for each trait derived.

also manually impl `Eq` because the `derive_where` generated code is too much for my comfort (cc ModProg/derive-where#128)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…r, r=jieyouxu

some `derive_more` refactors

some clauses can be merged together without requiring an attribute for each trait derived.

also manually impl `Eq` because the `derive_where` generated code is too much for my comfort (cc ModProg/derive-where#128)
rust-timer added a commit to rust-lang/rust that referenced this pull request Aug 10, 2025
Rollup merge of #145145 - fee1-dead-contrib:push-qnmpmtmtpkkr, r=jieyouxu

some `derive_more` refactors

some clauses can be merged together without requiring an attribute for each trait derived.

also manually impl `Eq` because the `derive_where` generated code is too much for my comfort (cc ModProg/derive-where#128)
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.

1 participant