-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Check for "constants we match on must be PartialEq" misses lifetime-dependent impls #121007
Copy link
Copy link
Open
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-patternsRelating to patterns and pattern matchingRelating to patterns and pattern matchingA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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_regionshere, 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.