pattern_analysis doesn't need to know what spans are

This commit is contained in:
Nadrieril
2023-12-15 16:18:21 +01:00
parent 8c5e89907c
commit 1e89a38423
6 changed files with 39 additions and 36 deletions

View File

@@ -37,14 +37,17 @@ use crate::rustc::RustcMatchCheckCtxt;
use crate::usefulness::{compute_match_usefulness, ValidityConstraint};
pub trait MatchCx: Sized + Clone + fmt::Debug {
/// The type of a pattern.
type Ty: Copy + Clone + fmt::Debug; // FIXME: remove Copy
type Span: Clone + Default;
/// The index of an enum variant.
type VariantIdx: Clone + Idx;
/// A string literal
type StrLit: Clone + PartialEq + fmt::Debug;
/// Extra data to store on a match arm.
type ArmData: Copy + Clone + fmt::Debug;
/// Extra data to store on a pattern. `Default` needed when we create fictitious wildcard
/// patterns during analysis.
type PatData: Clone + Default;
fn is_opaque_ty(ty: Self::Ty) -> bool;
fn is_exhaustive_patterns_feature_on(&self) -> bool;