`StructuralPartialEq` pat check does not check hr regions
Open
Nobody has claimed this yet.
fixed-by-next-solver
needs-triage
requires-nightly
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
The following code
#![feature(structural_match)]
struct Thing;
trait IsStatic {}
impl<'a: 'static> IsStatic for &'a () {}
impl std::marker::StructuralPartialEq for Thing where for<'a> &'a (): IsStatic {}
impl PartialEq for Thing
where
for<'a> &'a (): IsStatic,
{
fn eq(&self, _: &Thing) -> bool {
panic!()
}
}
const A: Thing = Thing;
fn main() {
let A = Thing;
}
built with --edition=2024
compiled with the old solver:
<no output>
but failed to compile with the new solver:
error: constant of non-structural type `Thing` in a pattern
--> ./main_corpus/88596606350047689476980845282776363502.rs:22:9
|
3 | struct Thing;
| ------------ `Thing` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
19 | const A: Thing = Thing;
| -------------- constant defined here
...
22 | let A = Thing;
| ^ constant of non-structural type
error: aborting due to 1 previous error
version inforamtion
rustc 1.99.0-nightly (4fefe3656 2026-07-27)
binary: rustc
commit-hash: 4fefe3656700e5528edddc2336667818917dfc70
commit-date: 2026-07-27
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the minimal Rust reproducer in the issue with the old and new solvers, focusing on the StructuralPartialEq pattern check and its handling of higher-ranked regions. Done means the new solver checks these regions consistently and the reproducer no longer exhibits the reported mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100