-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Mark a few libcore types as structurally equal if their contents are #70759
Conversation
09f18c6
to
2219744
Compare
What is the goal here, using Seems like these impls are not currently necessary for constant pattern matching because everything built-in is known to the compiler without them. |
It's actually not correct to bound the generic parameters by I can try to explain why this needs to be the case, but that might be easier to do synchronously. |
Hmm, I wonder if all of these things are true in the face of specialization -- ah, I guess they are. e.g. the |
@ecstatic-morse I don't really understand your comment, I'm afraid. |
r? @ecstatic-morse or @eddyb |
This is not quite what we want, let's keep discussing in #31434 |
str
was just missing a markerStructuralEq
types are already treated asStructuralEq
in the rustc pattern match logicStructuralEq
types are also already treated asStructuralEq
[T]
types shouldn't behave differently from arrays in pattern matching, so I marked them asStructuralEq
if their contents are.&T
types whereT: StructuralEq
cannot have a customEq
orPartialEq
impl, they must be using the generic impl. Thus the user cannot have created any handwritten impls for&UserType
, thus we can treat them asStructuralEq
.r? @petrochenkov
cc @pnkfelix @nikomatsakis @ecstatic-morse
cc #31434