Push the decision to skip fields further down
This commit is contained in:
@@ -82,6 +82,10 @@ use crate::usefulness::{compute_match_usefulness, ValidityConstraint};
|
||||
pub trait Captures<'a> {}
|
||||
impl<'a, T: ?Sized> Captures<'a> for T {}
|
||||
|
||||
/// `bool` newtype that indicates whether we should skip this field during analysis.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub struct SkipField(pub bool);
|
||||
|
||||
/// Context that provides type information about constructors.
|
||||
///
|
||||
/// Most of the crate is parameterized on a type that implements this trait.
|
||||
@@ -105,13 +109,13 @@ pub trait TypeCx: Sized + fmt::Debug {
|
||||
/// The number of fields for this constructor.
|
||||
fn ctor_arity(&self, ctor: &Constructor<Self>, ty: &Self::Ty) -> usize;
|
||||
|
||||
/// The types of the fields for this constructor. The result must have a length of
|
||||
/// `ctor_arity()`.
|
||||
/// The types of the fields for this constructor. The result must contain `ctor_arity()`-many
|
||||
/// fields that are not skipped.
|
||||
fn ctor_sub_tys<'a>(
|
||||
&'a self,
|
||||
ctor: &'a Constructor<Self>,
|
||||
ty: &'a Self::Ty,
|
||||
) -> impl Iterator<Item = Self::Ty> + ExactSizeIterator + Captures<'a>;
|
||||
) -> impl Iterator<Item = (Self::Ty, SkipField)> + ExactSizeIterator + Captures<'a>;
|
||||
|
||||
/// The set of all the constructors for `ty`.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user