diff options
| author | Tshepang Mbambo <hopsi@tuta.io> | 2025-07-17 06:25:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-17 06:25:42 +0200 |
| commit | b2474c87e1e4a8f01ba935084bb99804942de91b (patch) | |
| tree | 5e7f3165b5beac3fe72f520dbb94be30b73101bb /compiler/rustc_pattern_analysis/src/lib.rs | |
| parent | c113a60c0417ed9b9531648be9aa3d3c82a4524f (diff) | |
| parent | ce0de761f333204d931d2d43a96468986f51ebbd (diff) | |
| download | rust-b2474c87e1e4a8f01ba935084bb99804942de91b.tar.gz rust-b2474c87e1e4a8f01ba935084bb99804942de91b.zip | |
Merge pull request #2508 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lib.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 2b85d7b26ce..66df35f9ee4 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -8,6 +8,7 @@ #![allow(unused_crate_dependencies)] // tidy-alphabetical-end +pub(crate) mod checks; pub mod constructor; #[cfg(feature = "rustc")] pub mod errors; @@ -107,6 +108,20 @@ pub trait PatCx: Sized + fmt::Debug { _gapped_with: &[&DeconstructedPat<Self>], ) { } + + /// 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. + fn report_mixed_deref_pat_ctors( + &self, + deref_pat: &DeconstructedPat<Self>, + normal_pat: &DeconstructedPat<Self>, + ) -> Self::Error; } /// The arm of a match expression. |
