only check for mixed deref/normal constructors when needed

This commit is contained in:
dianne
2025-07-04 21:53:03 -07:00
parent 50061f3b11
commit bb64315978
5 changed files with 26 additions and 1 deletions

View File

@@ -109,6 +109,11 @@ pub trait PatCx: Sized + fmt::Debug {
) {
}
/// Check if we may need to perform additional deref-pattern-specific validation.
fn match_may_contain_deref_pats(&self) -> bool {
true
}
/// The current implementation of deref patterns requires that they can't match on the same
/// place as a normal constructor. Since this isn't caught by type-checking, we check it in the
/// `PatCx` before running the analysis. This reports an error if the check fails.