Skip to content

Commit ff59620

Browse files
committed
Rename hair::PatternKind to hair::PatKind
1 parent 1ae3c36 commit ff59620

File tree

10 files changed

+222
-222
lines changed

10 files changed

+222
-222
lines changed

src/librustc_mir/build/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
9898
initializer,
9999
lint_level
100100
} => {
101-
let ignores_expr_result = if let PatternKind::Wild = *pattern.kind {
101+
let ignores_expr_result = if let PatKind::Wild = *pattern.kind {
102102
true
103103
} else {
104104
false

src/librustc_mir/build/matches/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
303303
) -> BlockAnd<()> {
304304
match *irrefutable_pat.kind {
305305
// Optimize the case of `let x = ...` to write directly into `x`
306-
PatternKind::Binding {
306+
PatKind::Binding {
307307
mode: BindingMode::ByValue,
308308
var,
309309
subpattern: None,
@@ -336,9 +336,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
336336
// test works with uninitialized values in a rather
337337
// dubious way, so it may be that the test is kind of
338338
// broken.
339-
PatternKind::AscribeUserType {
339+
PatKind::AscribeUserType {
340340
subpattern: Pattern {
341-
kind: box PatternKind::Binding {
341+
kind: box PatKind::Binding {
342342
mode: BindingMode::ByValue,
343343
var,
344344
subpattern: None,
@@ -571,7 +571,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
571571
) {
572572
debug!("visit_bindings: pattern={:?} pattern_user_ty={:?}", pattern, pattern_user_ty);
573573
match *pattern.kind {
574-
PatternKind::Binding {
574+
PatKind::Binding {
575575
mutability,
576576
name,
577577
mode,
@@ -586,12 +586,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
586586
}
587587
}
588588

589-
PatternKind::Array {
589+
PatKind::Array {
590590
ref prefix,
591591
ref slice,
592592
ref suffix,
593593
}
594-
| PatternKind::Slice {
594+
| PatKind::Slice {
595595
ref prefix,
596596
ref slice,
597597
ref suffix,
@@ -609,13 +609,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
609609
}
610610
}
611611

612-
PatternKind::Constant { .. } | PatternKind::Range { .. } | PatternKind::Wild => {}
612+
PatKind::Constant { .. } | PatKind::Range { .. } | PatKind::Wild => {}
613613

614-
PatternKind::Deref { ref subpattern } => {
614+
PatKind::Deref { ref subpattern } => {
615615
self.visit_bindings(subpattern, pattern_user_ty.deref(), f);
616616
}
617617

618-
PatternKind::AscribeUserType {
618+
PatKind::AscribeUserType {
619619
ref subpattern,
620620
ascription: hair::pattern::Ascription {
621621
ref user_ty,
@@ -644,22 +644,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
644644
self.visit_bindings(subpattern, subpattern_user_ty, f)
645645
}
646646

647-
PatternKind::Leaf { ref subpatterns } => {
647+
PatKind::Leaf { ref subpatterns } => {
648648
for subpattern in subpatterns {
649649
let subpattern_user_ty = pattern_user_ty.clone().leaf(subpattern.field);
650650
debug!("visit_bindings: subpattern_user_ty={:?}", subpattern_user_ty);
651651
self.visit_bindings(&subpattern.pattern, subpattern_user_ty, f);
652652
}
653653
}
654654

655-
PatternKind::Variant { adt_def, substs: _, variant_index, ref subpatterns } => {
655+
PatKind::Variant { adt_def, substs: _, variant_index, ref subpatterns } => {
656656
for subpattern in subpatterns {
657657
let subpattern_user_ty = pattern_user_ty.clone().variant(
658658
adt_def, variant_index, subpattern.field);
659659
self.visit_bindings(&subpattern.pattern, subpattern_user_ty, f);
660660
}
661661
}
662-
PatternKind::Or { ref pats } => {
662+
PatKind::Or { ref pats } => {
663663
for pat in pats {
664664
self.visit_bindings(&pat, pattern_user_ty.clone(), f);
665665
}

src/librustc_mir/build/matches/simplify.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
5757
-> Result<(), MatchPair<'pat, 'tcx>> {
5858
let tcx = self.hir.tcx();
5959
match *match_pair.pattern.kind {
60-
PatternKind::AscribeUserType {
60+
PatKind::AscribeUserType {
6161
ref subpattern,
6262
ascription: hair::pattern::Ascription {
6363
variance,
@@ -79,12 +79,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
7979
Ok(())
8080
}
8181

82-
PatternKind::Wild => {
82+
PatKind::Wild => {
8383
// nothing left to do
8484
Ok(())
8585
}
8686

87-
PatternKind::Binding { name, mutability, mode, var, ty, ref subpattern } => {
87+
PatKind::Binding { name, mutability, mode, var, ty, ref subpattern } => {
8888
candidate.bindings.push(Binding {
8989
name,
9090
mutability,
@@ -103,12 +103,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
103103
Ok(())
104104
}
105105

106-
PatternKind::Constant { .. } => {
106+
PatKind::Constant { .. } => {
107107
// FIXME normalize patterns when possible
108108
Err(match_pair)
109109
}
110110

111-
PatternKind::Range(PatternRange { lo, hi, end }) => {
111+
PatKind::Range(PatternRange { lo, hi, end }) => {
112112
let (range, bias) = match lo.ty.kind {
113113
ty::Char => {
114114
(Some(('\u{0000}' as u128, '\u{10FFFF}' as u128, Size::from_bits(32))), 0)
@@ -144,7 +144,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
144144
Err(match_pair)
145145
}
146146

147-
PatternKind::Slice { ref prefix, ref slice, ref suffix } => {
147+
PatKind::Slice { ref prefix, ref slice, ref suffix } => {
148148
if prefix.is_empty() && slice.is_some() && suffix.is_empty() {
149149
// irrefutable
150150
self.prefix_slice_suffix(&mut candidate.match_pairs,
@@ -158,7 +158,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
158158
}
159159
}
160160

161-
PatternKind::Variant { adt_def, substs, variant_index, ref subpatterns } => {
161+
PatKind::Variant { adt_def, substs, variant_index, ref subpatterns } => {
162162
let irrefutable = adt_def.variants.iter_enumerated().all(|(i, v)| {
163163
i == variant_index || {
164164
self.hir.tcx().features().exhaustive_patterns &&
@@ -174,7 +174,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
174174
}
175175
}
176176

177-
PatternKind::Array { ref prefix, ref slice, ref suffix } => {
177+
PatKind::Array { ref prefix, ref slice, ref suffix } => {
178178
self.prefix_slice_suffix(&mut candidate.match_pairs,
179179
&match_pair.place,
180180
prefix,
@@ -183,20 +183,20 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
183183
Ok(())
184184
}
185185

186-
PatternKind::Leaf { ref subpatterns } => {
186+
PatKind::Leaf { ref subpatterns } => {
187187
// tuple struct, match subpats (if any)
188188
candidate.match_pairs
189189
.extend(self.field_match_pairs(match_pair.place, subpatterns));
190190
Ok(())
191191
}
192192

193-
PatternKind::Deref { ref subpattern } => {
193+
PatKind::Deref { ref subpattern } => {
194194
let place = match_pair.place.deref();
195195
candidate.match_pairs.push(MatchPair::new(place, subpattern));
196196
Ok(())
197197
}
198198

199-
PatternKind::Or { .. } => {
199+
PatKind::Or { .. } => {
200200
Err(match_pair)
201201
}
202202
}

src/librustc_mir/build/matches/test.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2626
/// It is a bug to call this with a simplifiable pattern.
2727
pub fn test<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> Test<'tcx> {
2828
match *match_pair.pattern.kind {
29-
PatternKind::Variant { ref adt_def, substs: _, variant_index: _, subpatterns: _ } => {
29+
PatKind::Variant { ref adt_def, substs: _, variant_index: _, subpatterns: _ } => {
3030
Test {
3131
span: match_pair.pattern.span,
3232
kind: TestKind::Switch {
@@ -36,7 +36,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
3636
}
3737
}
3838

39-
PatternKind::Constant { .. } if is_switch_ty(match_pair.pattern.ty) => {
39+
PatKind::Constant { .. } if is_switch_ty(match_pair.pattern.ty) => {
4040
// For integers, we use a `SwitchInt` match, which allows
4141
// us to handle more cases.
4242
Test {
@@ -52,7 +52,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
5252
}
5353
}
5454

55-
PatternKind::Constant { value } => {
55+
PatKind::Constant { value } => {
5656
Test {
5757
span: match_pair.pattern.span,
5858
kind: TestKind::Eq {
@@ -62,7 +62,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6262
}
6363
}
6464

65-
PatternKind::Range(range) => {
65+
PatKind::Range(range) => {
6666
assert_eq!(range.lo.ty, match_pair.pattern.ty);
6767
assert_eq!(range.hi.ty, match_pair.pattern.ty);
6868
Test {
@@ -71,7 +71,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
7171
}
7272
}
7373

74-
PatternKind::Slice { ref prefix, ref slice, ref suffix } => {
74+
PatKind::Slice { ref prefix, ref slice, ref suffix } => {
7575
let len = prefix.len() + suffix.len();
7676
let op = if slice.is_some() {
7777
BinOp::Ge
@@ -84,13 +84,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
8484
}
8585
}
8686

87-
PatternKind::AscribeUserType { .. } |
88-
PatternKind::Array { .. } |
89-
PatternKind::Wild |
90-
PatternKind::Or { .. } |
91-
PatternKind::Binding { .. } |
92-
PatternKind::Leaf { .. } |
93-
PatternKind::Deref { .. } => {
87+
PatKind::AscribeUserType { .. } |
88+
PatKind::Array { .. } |
89+
PatKind::Wild |
90+
PatKind::Or { .. } |
91+
PatKind::Binding { .. } |
92+
PatKind::Leaf { .. } |
93+
PatKind::Deref { .. } => {
9494
self.error_simplifyable(match_pair)
9595
}
9696
}
@@ -110,7 +110,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
110110
};
111111

112112
match *match_pair.pattern.kind {
113-
PatternKind::Constant { value } => {
113+
PatKind::Constant { value } => {
114114
indices.entry(value)
115115
.or_insert_with(|| {
116116
options.push(value.eval_bits(
@@ -120,22 +120,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
120120
});
121121
true
122122
}
123-
PatternKind::Variant { .. } => {
123+
PatKind::Variant { .. } => {
124124
panic!("you should have called add_variants_to_switch instead!");
125125
}
126-
PatternKind::Range(range) => {
126+
PatKind::Range(range) => {
127127
// Check that none of the switch values are in the range.
128128
self.values_not_contained_in_range(range, indices)
129129
.unwrap_or(false)
130130
}
131-
PatternKind::Slice { .. } |
132-
PatternKind::Array { .. } |
133-
PatternKind::Wild |
134-
PatternKind::Or { .. } |
135-
PatternKind::Binding { .. } |
136-
PatternKind::AscribeUserType { .. } |
137-
PatternKind::Leaf { .. } |
138-
PatternKind::Deref { .. } => {
131+
PatKind::Slice { .. } |
132+
PatKind::Array { .. } |
133+
PatKind::Wild |
134+
PatKind::Or { .. } |
135+
PatKind::Binding { .. } |
136+
PatKind::AscribeUserType { .. } |
137+
PatKind::Leaf { .. } |
138+
PatKind::Deref { .. } => {
139139
// don't know how to add these patterns to a switch
140140
false
141141
}
@@ -154,7 +154,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
154154
};
155155

156156
match *match_pair.pattern.kind {
157-
PatternKind::Variant { adt_def: _ , variant_index, .. } => {
157+
PatKind::Variant { adt_def: _ , variant_index, .. } => {
158158
// We have a pattern testing for variant `variant_index`
159159
// set the corresponding index to true
160160
variants.insert(variant_index);
@@ -533,7 +533,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
533533
// If we are performing a variant switch, then this
534534
// informs variant patterns, but nothing else.
535535
(&TestKind::Switch { adt_def: tested_adt_def, .. },
536-
&PatternKind::Variant { adt_def, variant_index, ref subpatterns, .. }) => {
536+
&PatKind::Variant { adt_def, variant_index, ref subpatterns, .. }) => {
537537
assert_eq!(adt_def, tested_adt_def);
538538
self.candidate_after_variant_switch(match_pair_index,
539539
adt_def,
@@ -548,18 +548,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
548548
// If we are performing a switch over integers, then this informs integer
549549
// equality, but nothing else.
550550
//
551-
// FIXME(#29623) we could use PatternKind::Range to rule
551+
// FIXME(#29623) we could use PatKind::Range to rule
552552
// things out here, in some cases.
553553
(&TestKind::SwitchInt { switch_ty: _, options: _, ref indices },
554-
&PatternKind::Constant { ref value })
554+
&PatKind::Constant { ref value })
555555
if is_switch_ty(match_pair.pattern.ty) => {
556556
let index = indices[value];
557557
self.candidate_without_match_pair(match_pair_index, candidate);
558558
Some(index)
559559
}
560560

561561
(&TestKind::SwitchInt { switch_ty: _, ref options, ref indices },
562-
&PatternKind::Range(range)) => {
562+
&PatKind::Range(range)) => {
563563
let not_contained = self
564564
.values_not_contained_in_range(range, indices)
565565
.unwrap_or(false);
@@ -577,7 +577,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
577577
(&TestKind::SwitchInt { .. }, _) => None,
578578

579579
(&TestKind::Len { len: test_len, op: BinOp::Eq },
580-
&PatternKind::Slice { ref prefix, ref slice, ref suffix }) => {
580+
&PatKind::Slice { ref prefix, ref slice, ref suffix }) => {
581581
let pat_len = (prefix.len() + suffix.len()) as u64;
582582
match (test_len.cmp(&pat_len), slice) {
583583
(Ordering::Equal, &None) => {
@@ -610,7 +610,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
610610
}
611611

612612
(&TestKind::Len { len: test_len, op: BinOp::Ge },
613-
&PatternKind::Slice { ref prefix, ref slice, ref suffix }) => {
613+
&PatKind::Slice { ref prefix, ref slice, ref suffix }) => {
614614
// the test is `$actual_len >= test_len`
615615
let pat_len = (prefix.len() + suffix.len()) as u64;
616616
match (test_len.cmp(&pat_len), slice) {
@@ -644,7 +644,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
644644
}
645645

646646
(&TestKind::Range(test),
647-
&PatternKind::Range(pat)) => {
647+
&PatKind::Range(pat)) => {
648648
if test == pat {
649649
self.candidate_without_match_pair(
650650
match_pair_index,
@@ -683,7 +683,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
683683
}
684684
}
685685

686-
(&TestKind::Range(range), &PatternKind::Constant { value }) => {
686+
(&TestKind::Range(range), &PatKind::Constant { value }) => {
687687
if self.const_range_contains(range, value) == Some(false) {
688688
// `value` is not contained in the testing range,
689689
// so `value` can be matched only if this test fails.

src/librustc_mir/build/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::build;
22
use crate::build::scope::DropKind;
33
use crate::hair::cx::Cx;
4-
use crate::hair::{LintLevel, BindingMode, PatternKind};
4+
use crate::hair::{LintLevel, BindingMode, PatKind};
55
use crate::transform::MirSource;
66
use crate::util as mir_util;
77
use rustc::hir;
@@ -827,7 +827,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
827827
self.set_correct_source_scope_for_arg(arg.hir_id, original_source_scope, span);
828828
match *pattern.kind {
829829
// Don't introduce extra copies for simple bindings
830-
PatternKind::Binding {
830+
PatKind::Binding {
831831
mutability,
832832
var,
833833
mode: BindingMode::ByValue,

src/librustc_mir/hair/cx/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn mirror_stmts<'a, 'tcx>(
8181
pattern = Pattern {
8282
ty: pattern.ty,
8383
span: pattern.span,
84-
kind: Box::new(PatternKind::AscribeUserType {
84+
kind: Box::new(PatKind::AscribeUserType {
8585
ascription: hair::pattern::Ascription {
8686
user_ty: PatternTypeProjection::from_user_type(user_ty),
8787
user_ty_span: ty.span,

0 commit comments

Comments
 (0)