s/MatchCx/TypeCx/
This commit is contained in:
parent
4bcf66f875
commit
3016c29628
6 changed files with 48 additions and 48 deletions
|
@ -49,16 +49,16 @@ impl<'a, T: ?Sized> Captures<'a> for T {}
|
|||
/// Context that provides type information about constructors.
|
||||
///
|
||||
/// Most of the crate is parameterized on a type that implements this trait.
|
||||
pub trait MatchCx: Sized + Clone + fmt::Debug {
|
||||
pub trait TypeCx: Sized + Clone + fmt::Debug {
|
||||
/// The type of a pattern.
|
||||
type Ty: Copy + Clone + fmt::Debug; // FIXME: remove Copy
|
||||
/// 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.
|
||||
/// Extra data to store in a match arm.
|
||||
type ArmData: Copy + Clone + fmt::Debug;
|
||||
/// Extra data to store on a pattern. `Default` needed when we create fictitious wildcard
|
||||
/// Extra data to store in a pattern. `Default` needed when we create fictitious wildcard
|
||||
/// patterns during analysis.
|
||||
type PatData: Clone + Default;
|
||||
|
||||
|
@ -86,24 +86,24 @@ pub trait MatchCx: Sized + Clone + fmt::Debug {
|
|||
|
||||
/// Context that provides information global to a match.
|
||||
#[derive(Clone)]
|
||||
pub struct MatchCtxt<'a, 'p, Cx: MatchCx> {
|
||||
pub struct MatchCtxt<'a, 'p, Cx: TypeCx> {
|
||||
/// The context for type information.
|
||||
pub tycx: &'a Cx,
|
||||
/// An arena to store the wildcards we produce during analysis.
|
||||
pub wildcard_arena: &'a TypedArena<DeconstructedPat<'p, Cx>>,
|
||||
}
|
||||
|
||||
impl<'a, 'p, Cx: MatchCx> Copy for MatchCtxt<'a, 'p, Cx> {}
|
||||
impl<'a, 'p, Cx: TypeCx> Copy for MatchCtxt<'a, 'p, Cx> {}
|
||||
|
||||
/// The arm of a match expression.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MatchArm<'p, Cx: MatchCx> {
|
||||
pub struct MatchArm<'p, Cx: TypeCx> {
|
||||
pub pat: &'p DeconstructedPat<'p, Cx>,
|
||||
pub has_guard: bool,
|
||||
pub arm_data: Cx::ArmData,
|
||||
}
|
||||
|
||||
impl<'p, Cx: MatchCx> Copy for MatchArm<'p, Cx> {}
|
||||
impl<'p, Cx: TypeCx> Copy for MatchArm<'p, Cx> {}
|
||||
|
||||
/// The entrypoint for this crate. Computes whether a match is exhaustive and which of its arms are
|
||||
/// useful, and runs some lints.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue