Check for "constants we match on must be PartialEq" misses lifetime-dependent impls #121007
Labels
A-lifetimes
Area: Lifetimes / regions
A-patterns
Relating to patterns and pattern matching
A-trait-system
Area: Trait system
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
The following should trigger a warning that we can only match on PartialEq consts, but it doesn't: (example by @lcnr, then slightly tweaked)
Here is another example of the same issue.
The problem is that we call
predicate_must_hold_modulo_regions
here, but only borrowck knows the actual lifetimes and borrowck has no idea that this trait obligation even exists.We should leave some sort of trace in MIR that there is a PartialEq obligations to ensure borrowck can check this with the right lifetimes.
The text was updated successfully, but these errors were encountered: