always check for mixed deref pattern and normal constructors
This makes it work for box patterns and in rust-analyzer.
This commit is contained in:
@@ -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,15 @@ pub trait PatCx: Sized + fmt::Debug {
|
||||
_gapped_with: &[&DeconstructedPat<Self>],
|
||||
) {
|
||||
}
|
||||
|
||||
/// 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.
|
||||
|
||||
Reference in New Issue
Block a user