Skip to content

Commit ff4ed8c

Browse files
committed
Rename hair::Pattern to hair::Pat
1 parent 79ff448 commit ff4ed8c

File tree

9 files changed

+108
-113
lines changed

9 files changed

+108
-113
lines changed

src/librustc_mir/build/matches/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
298298
pub(super) fn expr_into_pattern(
299299
&mut self,
300300
mut block: BasicBlock,
301-
irrefutable_pat: Pattern<'tcx>,
301+
irrefutable_pat: Pat<'tcx>,
302302
initializer: ExprRef<'tcx>,
303303
) -> BlockAnd<()> {
304304
match *irrefutable_pat.kind {
@@ -337,7 +337,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
337337
// dubious way, so it may be that the test is kind of
338338
// broken.
339339
PatKind::AscribeUserType {
340-
subpattern: Pattern {
340+
subpattern: Pat {
341341
kind: box PatKind::Binding {
342342
mode: BindingMode::ByValue,
343343
var,
@@ -414,7 +414,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
414414
pub fn place_into_pattern(
415415
&mut self,
416416
block: BasicBlock,
417-
irrefutable_pat: Pattern<'tcx>,
417+
irrefutable_pat: Pat<'tcx>,
418418
initializer: &Place<'tcx>,
419419
set_match_place: bool,
420420
) -> BlockAnd<()> {
@@ -486,7 +486,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
486486
&mut self,
487487
mut visibility_scope: Option<SourceScope>,
488488
scope_span: Span,
489-
pattern: &Pattern<'tcx>,
489+
pattern: &Pat<'tcx>,
490490
has_guard: ArmHasGuard,
491491
opt_match_place: Option<(Option<&Place<'tcx>>, Span)>,
492492
) -> Option<SourceScope> {
@@ -556,7 +556,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
556556

557557
pub(super) fn visit_bindings(
558558
&mut self,
559-
pattern: &Pattern<'tcx>,
559+
pattern: &Pat<'tcx>,
560560
pattern_user_ty: UserTypeProjections,
561561
f: &mut impl FnMut(
562562
&mut Self,
@@ -718,7 +718,7 @@ pub struct MatchPair<'pat, 'tcx> {
718718
place: Place<'tcx>,
719719

720720
// ... must match this pattern.
721-
pattern: &'pat Pattern<'tcx>,
721+
pattern: &'pat Pat<'tcx>,
722722
}
723723

724724
#[derive(Clone, Debug, PartialEq)]
@@ -1339,7 +1339,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13391339
}
13401340

13411341
///////////////////////////////////////////////////////////////////////////
1342-
// Pattern binding - used for `let` and function parameters as well.
1342+
// Pat binding - used for `let` and function parameters as well.
13431343

13441344
impl<'a, 'tcx> Builder<'a, 'tcx> {
13451345
/// Initializes each of the bindings from the candidate by

src/librustc_mir/build/matches/test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
722722
fn candidate_after_slice_test<'pat>(&mut self,
723723
match_pair_index: usize,
724724
candidate: &mut Candidate<'pat, 'tcx>,
725-
prefix: &'pat [Pattern<'tcx>],
726-
opt_slice: Option<&'pat Pattern<'tcx>>,
727-
suffix: &'pat [Pattern<'tcx>]) {
725+
prefix: &'pat [Pat<'tcx>],
726+
opt_slice: Option<&'pat Pat<'tcx>>,
727+
suffix: &'pat [Pat<'tcx>]) {
728728
let removed_place = candidate.match_pairs.remove(match_pair_index).place;
729729
self.prefix_slice_suffix(
730730
&mut candidate.match_pairs,

src/librustc_mir/build/matches/util.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2222
pub fn prefix_slice_suffix<'pat>(&mut self,
2323
match_pairs: &mut Vec<MatchPair<'pat, 'tcx>>,
2424
place: &Place<'tcx>,
25-
prefix: &'pat [Pattern<'tcx>],
26-
opt_slice: Option<&'pat Pattern<'tcx>>,
27-
suffix: &'pat [Pattern<'tcx>]) {
25+
prefix: &'pat [Pat<'tcx>],
26+
opt_slice: Option<&'pat Pat<'tcx>>,
27+
suffix: &'pat [Pat<'tcx>]) {
2828
let min_length = prefix.len() + suffix.len();
2929
let min_length = min_length.try_into().unwrap();
3030

@@ -101,7 +101,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
101101
}
102102

103103
impl<'pat, 'tcx> MatchPair<'pat, 'tcx> {
104-
pub fn new(place: Place<'tcx>, pattern: &'pat Pattern<'tcx>) -> MatchPair<'pat, 'tcx> {
104+
pub fn new(place: Place<'tcx>, pattern: &'pat Pat<'tcx>) -> MatchPair<'pat, 'tcx> {
105105
MatchPair {
106106
place,
107107
pattern,

src/librustc_mir/hair/cx/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn mirror_stmts<'a, 'tcx>(
7878
if let Some(ty) = &local.ty {
7979
if let Some(&user_ty) = cx.tables.user_provided_types().get(ty.hir_id) {
8080
debug!("mirror_stmts: user_ty={:?}", user_ty);
81-
pattern = Pattern {
81+
pattern = Pat {
8282
ty: pattern.ty,
8383
span: pattern.span,
8484
kind: Box::new(PatKind::AscribeUserType {

src/librustc_mir/hair/cx/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,13 @@ impl<'a, 'tcx> Cx<'a, 'tcx> {
153153
}
154154
}
155155

156-
pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pattern<'tcx> {
156+
pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pat<'tcx> {
157157
let tcx = self.tcx.global_tcx();
158158
let p = match tcx.hir().get(p.hir_id) {
159159
Node::Pat(p) | Node::Binding(p) => p,
160160
node => bug!("pattern became {:?}", node)
161161
};
162-
Pattern::from_hir(tcx,
163-
self.param_env.and(self.identity_substs),
164-
self.tables(),
165-
p)
162+
Pat::from_hir(tcx, self.param_env.and(self.identity_substs), self.tables(), p)
166163
}
167164

168165
pub fn trait_method(&mut self,

src/librustc_mir/hair/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub mod cx;
2020
mod constant;
2121

2222
pub mod pattern;
23-
pub use self::pattern::{BindingMode, Pattern, PatKind, PatRange, FieldPat};
23+
pub use self::pattern::{BindingMode, Pat, PatKind, PatRange, FieldPat};
2424
pub(crate) use self::pattern::PatTyProj;
2525

2626
mod util;
@@ -83,7 +83,7 @@ pub enum StmtKind<'tcx> {
8383
/// `let <PAT> = ...`
8484
///
8585
/// if a type is included, it is added as an ascription pattern
86-
pattern: Pattern<'tcx>,
86+
pattern: Pat<'tcx>,
8787

8888
/// let pat: ty = <INIT> ...
8989
initializer: Option<ExprRef<'tcx>>,
@@ -293,7 +293,7 @@ pub struct FruInfo<'tcx> {
293293

294294
#[derive(Clone, Debug)]
295295
pub struct Arm<'tcx> {
296-
pub pattern: Pattern<'tcx>,
296+
pub pattern: Pat<'tcx>,
297297
pub guard: Option<Guard<'tcx>>,
298298
pub body: ExprRef<'tcx>,
299299
pub lint_level: LintLevel,
@@ -304,7 +304,7 @@ pub struct Arm<'tcx> {
304304
impl Arm<'tcx> {
305305
// HACK(or_patterns; Centril | dlrobertson): Remove this and
306306
// correctly handle each case in which this method is used.
307-
pub fn top_pats_hack(&self) -> &[Pattern<'tcx>] {
307+
pub fn top_pats_hack(&self) -> &[Pat<'tcx>] {
308308
match &*self.pattern.kind {
309309
PatKind::Or { pats } => pats,
310310
_ => std::slice::from_ref(&self.pattern),

0 commit comments

Comments
 (0)