From bb643159786c789c0b64f819d36a0979c63f9791 Mon Sep 17 00:00:00 2001 From: dianne Date: Fri, 4 Jul 2025 21:53:03 -0700 Subject: only check for mixed deref/normal constructors when needed --- compiler/rustc_pattern_analysis/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler/rustc_pattern_analysis/src/lib.rs') diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 129fd38725c..66df35f9ee4 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -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. -- cgit 1.4.1-3-g733a5