Skip to content

Commit 41e8aed

Browse files
committed
typeck/pat.rs: check_pat_walk -> check_pat.
It's just shorter and we usually don't use the `_walk` suffix.
1 parent 65deeae commit 41e8aed

File tree

1 file changed

+19
-25
lines changed
  • src/librustc_typeck/check

1 file changed

+19
-25
lines changed

src/librustc_typeck/check/pat.rs

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3636
discrim_span: Option<Span>,
3737
) {
3838
let def_bm = ty::BindingMode::BindByValue(hir::Mutability::MutImmutable);
39-
self.check_pat_walk(pat, expected, def_bm, discrim_span);
39+
self.check_pat(pat, expected, def_bm, discrim_span);
4040
}
4141

4242
/// `discrim_span` argument having a `Span` indicates that this pattern is part of a match
@@ -55,14 +55,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5555
/// = note: expected type `usize`
5656
/// found type `std::result::Result<_, _>`
5757
/// ```
58-
fn check_pat_walk(
58+
fn check_pat(
5959
&self,
6060
pat: &'tcx hir::Pat,
6161
expected: Ty<'tcx>,
6262
def_bm: ty::BindingMode,
6363
discrim_span: Option<Span>,
6464
) {
65-
debug!("check_pat_walk(pat={:?},expected={:?},def_bm={:?})", pat, expected, def_bm);
65+
debug!("check_pat(pat={:?},expected={:?},def_bm={:?})", pat, expected, def_bm);
6666

6767
let path_resolution = match &pat.node {
6868
PatKind::Path(qpath) => Some(self.resolve_ty_and_res_ufcs(qpath, pat.hir_id, pat.span)),
@@ -104,7 +104,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
104104
PatKind::Or(pats) => {
105105
let expected_ty = self.structurally_resolved_type(pat.span, expected);
106106
for pat in pats {
107-
self.check_pat_walk(pat, expected, def_bm, discrim_span);
107+
self.check_pat(pat, expected, def_bm, discrim_span);
108108
}
109109
expected_ty
110110
}
@@ -456,7 +456,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
456456
}
457457

458458
if let Some(p) = sub {
459-
self.check_pat_walk(&p, expected, def_bm, discrim_span);
459+
self.check_pat(&p, expected, def_bm, discrim_span);
460460
}
461461

462462
local_ty
@@ -544,7 +544,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
544544
variant_ty
545545
} else {
546546
for field in fields {
547-
self.check_pat_walk(&field.pat, self.tcx.types.err, def_bm, discrim_span);
547+
self.check_pat(&field.pat, self.tcx.types.err, def_bm, discrim_span);
548548
}
549549
return self.tcx.types.err;
550550
};
@@ -607,7 +607,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
607607
let tcx = self.tcx;
608608
let on_error = || {
609609
for pat in subpats {
610-
self.check_pat_walk(&pat, tcx.types.err, def_bm, match_arm_pat_span);
610+
self.check_pat(&pat, tcx.types.err, def_bm, match_arm_pat_span);
611611
}
612612
};
613613
let report_unexpected_res = |res: Res| {
@@ -677,7 +677,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
677677
};
678678
for (i, subpat) in subpats.iter().enumerate_and_adjust(variant.fields.len(), ddpos) {
679679
let field_ty = self.field_ty(subpat.span, &variant.fields[i], substs);
680-
self.check_pat_walk(&subpat, field_ty, def_bm, match_arm_pat_span);
680+
self.check_pat(&subpat, field_ty, def_bm, match_arm_pat_span);
681681

682682
self.tcx.check_stability(variant.fields[i].did, Some(pat.hir_id), subpat.span);
683683
}
@@ -734,17 +734,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
734734
// further errors being emitted when using the bindings. #50333
735735
let element_tys_iter = (0..max_len).map(|_| tcx.types.err);
736736
for (_, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) {
737-
self.check_pat_walk(elem, &tcx.types.err, def_bm, discrim_span);
737+
self.check_pat(elem, &tcx.types.err, def_bm, discrim_span);
738738
}
739739
tcx.mk_tup(element_tys_iter)
740740
} else {
741741
for (i, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) {
742-
self.check_pat_walk(
743-
elem,
744-
&element_tys[i].expect_ty(),
745-
def_bm,
746-
discrim_span,
747-
);
742+
self.check_pat(elem, &element_tys[i].expect_ty(), def_bm, discrim_span);
748743
}
749744
pat_ty
750745
}
@@ -813,7 +808,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
813808
}
814809
};
815810

816-
self.check_pat_walk(&field.pat, field_ty, def_bm, None);
811+
self.check_pat(&field.pat, field_ty, def_bm, None);
817812
}
818813
let mut unmentioned_fields = variant.fields
819814
.iter()
@@ -941,13 +936,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
941936

942937
if self.check_dereferencable(span, expected, &inner) {
943938
// Here, `demand::subtype` is good enough, but I don't
944-
// think any errors can be introduced by using
945-
// `demand::eqtype`.
939+
// think any errors can be introduced by using `demand::eqtype`.
946940
self.demand_eqtype_pat(span, expected, uniq_ty, discrim_span);
947-
self.check_pat_walk(&inner, inner_ty, def_bm, discrim_span);
941+
self.check_pat(&inner, inner_ty, def_bm, discrim_span);
948942
uniq_ty
949943
} else {
950-
self.check_pat_walk(&inner, tcx.types.err, def_bm, discrim_span);
944+
self.check_pat(&inner, tcx.types.err, def_bm, discrim_span);
951945
tcx.types.err
952946
}
953947
}
@@ -998,10 +992,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
998992
}
999993
};
1000994

1001-
self.check_pat_walk(&inner, inner_ty, def_bm, discrim_span);
995+
self.check_pat(&inner, inner_ty, def_bm, discrim_span);
1002996
rptr_ty
1003997
} else {
1004-
self.check_pat_walk(&inner, tcx.types.err, def_bm, discrim_span);
998+
self.check_pat(&inner, tcx.types.err, def_bm, discrim_span);
1005999
tcx.types.err
10061000
}
10071001
}
@@ -1079,13 +1073,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10791073
};
10801074

10811075
for elt in before {
1082-
self.check_pat_walk(&elt, inner_ty, def_bm, discrim_span);
1076+
self.check_pat(&elt, inner_ty, def_bm, discrim_span);
10831077
}
10841078
if let Some(slice) = slice {
1085-
self.check_pat_walk(&slice, slice_ty, def_bm, discrim_span);
1079+
self.check_pat(&slice, slice_ty, def_bm, discrim_span);
10861080
}
10871081
for elt in after {
1088-
self.check_pat_walk(&elt, inner_ty, def_bm, discrim_span);
1082+
self.check_pat(&elt, inner_ty, def_bm, discrim_span);
10891083
}
10901084
expected_ty
10911085
}

0 commit comments

Comments
 (0)