#![allow(unused_crate_dependencies)]
pub(crate) mod checks;
pub mod constructor;
#[cfg(feature = "rustc")]
pub mod errors;
#[cfg(feature = "rustc")]
pub(crate) mod lints;
pub mod pat;
pub mod pat_column;
#[cfg(feature = "rustc")]
pub mod rustc;
pub mod usefulness;
use std::fmt;
pub use rustc_index::{Idx, IndexVec};
use crate::constructor::{Constructor, ConstructorSet, IntRange};
use crate::pat::DeconstructedPat;
pub trait Captures<'a> {}
impl<'a, T: ?Sized> Captures<'a> for T {}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct PrivateUninhabitedField(pub bool);
pub trait PatCx: Sized + fmt::Debug {
type Ty: Clone + fmt::Debug;
type Error: fmt::Debug;
type VariantIdx: Clone + Idx + fmt::Debug;
type StrLit: Clone + PartialEq + fmt::Debug;
type ArmData: Copy + Clone + fmt::Debug;
type PatData: Clone;
fn is_exhaustive_patterns_feature_on(&self) -> bool;
fn exhaustive_witnesses(&self) -> bool {
false
}
fn ctor_arity(&self, ctor: &Constructor<Self>, ty: &Self::Ty) -> usize;
fn ctor_sub_tys(
&self,
ctor: &Constructor<Self>,
ty: &Self::Ty,
) -> impl Iterator<Item = (Self::Ty, PrivateUninhabitedField)> + ExactSizeIterator;
fn ctors_for_ty(&self, ty: &Self::Ty) -> Result<ConstructorSet<Self>, Self::Error>;
fn write_variant_name(
f: &mut fmt::Formatter<'_>,
ctor: &crate::constructor::Constructor<Self>,
ty: &Self::Ty,
) -> fmt::Result;
fn bug(&self, fmt: fmt::Arguments<'_>) -> Self::Error;
fn lint_overlapping_range_endpoints(
&self,
_pat: &DeconstructedPat<Self>,
_overlaps_on: IntRange,
_overlaps_with: &[&DeconstructedPat<Self>],
) {
}
fn complexity_exceeded(&self) -> Result<(), Self::Error>;
fn lint_non_contiguous_range_endpoints(
&self,
_pat: &DeconstructedPat<Self>,
_gap: IntRange,
_gapped_with: &[&DeconstructedPat<Self>],
) {
}
fn match_may_contain_deref_pats(&self) -> bool {
true
}
fn report_mixed_deref_pat_ctors(
&self,
deref_pat: &DeconstructedPat<Self>,
normal_pat: &DeconstructedPat<Self>,
) -> Self::Error;
}
#[derive(Debug)]
pub struct MatchArm<'p, Cx: PatCx> {
pub pat: &'p DeconstructedPat<Cx>,
pub has_guard: bool,
pub arm_data: Cx::ArmData,
}
impl<'p, Cx: PatCx> Clone for MatchArm<'p, Cx> {
fn clone(&self) -> Self {
*self
}
}
impl<'p, Cx: PatCx> Copy for MatchArm<'p, Cx> {}