Rename hair::FieldPattern to hair::FieldPat

This commit is contained in:
varkor 2019-09-26 18:29:53 +01:00
parent 38121173e2
commit 1ae3c36800
5 changed files with 16 additions and 16 deletions

View File

@ -739,7 +739,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
match_pair_index: usize,
adt_def: &'tcx ty::AdtDef,
variant_index: VariantIdx,
subpatterns: &'pat [FieldPattern<'tcx>],
subpatterns: &'pat [FieldPat<'tcx>],
candidate: &mut Candidate<'pat, 'tcx>,
) {
let match_pair = candidate.match_pairs.remove(match_pair_index);

View File

@ -8,7 +8,7 @@ use std::convert::TryInto;
impl<'a, 'tcx> Builder<'a, 'tcx> {
pub fn field_match_pairs<'pat>(&mut self,
place: Place<'tcx>,
subpatterns: &'pat [FieldPattern<'tcx>])
subpatterns: &'pat [FieldPat<'tcx>])
-> Vec<MatchPair<'pat, 'tcx>> {
subpatterns.iter()
.map(|fieldpat| {

View File

@ -20,7 +20,7 @@ pub mod cx;
mod constant;
pub mod pattern;
pub use self::pattern::{BindingMode, Pattern, PatternKind, PatternRange, FieldPattern};
pub use self::pattern::{BindingMode, Pattern, PatternKind, PatternRange, FieldPat};
pub(crate) use self::pattern::PatternTypeProjection;
mod util;

View File

@ -163,7 +163,7 @@ use self::WitnessPreference::*;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::indexed_vec::Idx;
use super::{FieldPattern, Pattern, PatternKind, PatternRange};
use super::{FieldPat, Pattern, PatternKind, PatternRange};
use super::{PatternFoldable, PatternFolder, compare_const_vals};
use rustc::hir::def_id::DefId;
@ -569,7 +569,7 @@ impl<'tcx> Witness<'tcx> {
ty::Adt(..) |
ty::Tuple(..) => {
let pats = pats.enumerate().map(|(i, p)| {
FieldPattern {
FieldPat {
field: Field::new(i),
pattern: p
}
@ -1714,7 +1714,7 @@ fn constructor_covered_by_range<'tcx>(
}
fn patterns_for_variant<'p, 'tcx>(
subpatterns: &'p [FieldPattern<'tcx>],
subpatterns: &'p [FieldPat<'tcx>],
wild_patterns: &[&'p Pattern<'tcx>])
-> SmallVec<[&'p Pattern<'tcx>; 2]>
{

View File

@ -48,7 +48,7 @@ pub enum BindingMode {
}
#[derive(Clone, Debug)]
pub struct FieldPattern<'tcx> {
pub struct FieldPat<'tcx> {
pub field: Field,
pub pattern: Pattern<'tcx>,
}
@ -140,13 +140,13 @@ pub enum PatternKind<'tcx> {
adt_def: &'tcx AdtDef,
substs: SubstsRef<'tcx>,
variant_index: VariantIdx,
subpatterns: Vec<FieldPattern<'tcx>>,
subpatterns: Vec<FieldPat<'tcx>>,
},
/// `(...)`, `Foo(...)`, `Foo{...}`, or `Foo`, where `Foo` is a variant name from an ADT with
/// a single variant.
Leaf {
subpatterns: Vec<FieldPattern<'tcx>>,
subpatterns: Vec<FieldPat<'tcx>>,
},
/// `box P`, `&P`, `&mut P`, etc.
@ -578,7 +578,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
let subpatterns =
subpatterns.iter()
.enumerate_and_adjust(tys.len(), ddpos)
.map(|(i, subpattern)| FieldPattern {
.map(|(i, subpattern)| FieldPat {
field: Field::new(i),
pattern: self.lower_pattern(subpattern)
})
@ -650,7 +650,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
let subpatterns =
subpatterns.iter()
.enumerate_and_adjust(variant_def.fields.len(), ddpos)
.map(|(i, field)| FieldPattern {
.map(|(i, field)| FieldPat {
field: Field::new(i),
pattern: self.lower_pattern(field),
})
@ -664,7 +664,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
let subpatterns =
fields.iter()
.map(|field| {
FieldPattern {
FieldPat {
field: Field::new(self.tcx.field_index(field.hir_id,
self.tables)),
pattern: self.lower_pattern(&field.pat),
@ -772,7 +772,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
hir_id: hir::HirId,
span: Span,
ty: Ty<'tcx>,
subpatterns: Vec<FieldPattern<'tcx>>,
subpatterns: Vec<FieldPat<'tcx>>,
) -> PatternKind<'tcx> {
let res = match res {
Res::Def(DefKind::Ctor(CtorOf::Variant, ..), variant_ctor_id) => {
@ -1069,7 +1069,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
let mut adt_subpatterns = |n, variant_opt| {
(0..n).map(|i| {
let field = Field::new(i);
FieldPattern {
FieldPat {
field,
pattern: adt_subpattern(i, variant_opt),
}
@ -1361,9 +1361,9 @@ CloneImpls!{ <'tcx>
UserTypeProjection, PatternTypeProjection<'tcx>
}
impl<'tcx> PatternFoldable<'tcx> for FieldPattern<'tcx> {
impl<'tcx> PatternFoldable<'tcx> for FieldPat<'tcx> {
fn super_fold_with<F: PatternFolder<'tcx>>(&self, folder: &mut F) -> Self {
FieldPattern {
FieldPat {
field: self.field.fold_with(folder),
pattern: self.pattern.fold_with(folder)
}