Skip to content

const-in-pattern: test that the PartialEq impl does not need to be const #135064

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 4, 2025

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jan 3, 2025

Fixes #119398 by adding a test.

@compiler-errors is there some place in the code where we could add a comment saying "as a backcompat hack, here we only require PartialEq and not const PartialEq"?

r? @compiler-errors

@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 3, 2025
@RalfJung RalfJung force-pushed the const-in-pat-partial-eq-not-const branch from d8e53a6 to dbf3f22 Compare January 3, 2025 09:57
@compiler-errors
Copy link
Member

is there some place in the code where we could add a comment saying "as a backcompat hack, here we only require PartialEq and not const PartialEq"?

@RalfJung: You'd probably know best where to put that? I assume it would be at the same place we check that T: PartialEq holds for match scrutinees. Like next to that predicate_must_hold call or whatever we do, it'd be fine to note "and we don't check T: ~const PartialEq holds because of backcompat and <insert some other comment about how it's probably fine and doesn't cause ICEs since we structurally decompose matches anyways>".

@compiler-errors
Copy link
Member

Anyways r=me with or without that comment

@RalfJung
Copy link
Member Author

RalfJung commented Jan 3, 2025

Hm I thought there was something somewhere else, since ir was some PR of course that fixed the behavior here...

@RalfJung RalfJung force-pushed the const-in-pat-partial-eq-not-const branch from dbf3f22 to b806dcc Compare January 3, 2025 15:08
@rustbot
Copy link
Collaborator

rustbot commented Jan 3, 2025

Some changes occurred in match checking

cc @Nadrieril

@RalfJung
Copy link
Member Author

RalfJung commented Jan 3, 2025

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Jan 3, 2025

📌 Commit b806dcc has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 3, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 4, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#133964 (core: implement `bool::select_unpredictable`)
 - rust-lang#135001 (Allow using self-contained LLD in bootstrap)
 - rust-lang#135055 (Report impl method has stricter requirements even when RPITIT inference gets in the way)
 - rust-lang#135064 (const-in-pattern: test that the PartialEq impl does not need to be const)
 - rust-lang#135066 (bootstrap: support `./x check run-make-support`)
 - rust-lang#135069 (remove unused function params)
 - rust-lang#135084 (Update carrying_mul_add test to tolerate `nuw`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 966a5be into rust-lang:master Jan 4, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 4, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 4, 2025
Rollup merge of rust-lang#135064 - RalfJung:const-in-pat-partial-eq-not-const, r=compiler-errors

const-in-pattern: test that the PartialEq impl does not need to be const

Fixes rust-lang#119398 by adding a test.

`@compiler-errors`  is there some place in the code where we could add a comment saying "as a backcompat hack, here we only require `PartialEq` and not `const PartialEq`"?

r? `@compiler-errors`
@RalfJung RalfJung deleted the const-in-pat-partial-eq-not-const branch January 6, 2025 14:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

consts in patterns in const contexts with feature effects causes warning (soon: error) about not implementing PartialEq
4 participants