@@ -36,7 +36,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
36
36
discrim_span : Option < Span > ,
37
37
) {
38
38
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) ;
40
40
}
41
41
42
42
/// `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> {
55
55
/// = note: expected type `usize`
56
56
/// found type `std::result::Result<_, _>`
57
57
/// ```
58
- fn check_pat_walk (
58
+ fn check_pat (
59
59
& self ,
60
60
pat : & ' tcx hir:: Pat ,
61
61
expected : Ty < ' tcx > ,
62
62
def_bm : ty:: BindingMode ,
63
63
discrim_span : Option < Span > ,
64
64
) {
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) ;
66
66
67
67
let path_resolution = match & pat. node {
68
68
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> {
104
104
PatKind :: Or ( pats) => {
105
105
let expected_ty = self . structurally_resolved_type ( pat. span , expected) ;
106
106
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) ;
108
108
}
109
109
expected_ty
110
110
}
@@ -456,7 +456,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
456
456
}
457
457
458
458
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) ;
460
460
}
461
461
462
462
local_ty
@@ -544,7 +544,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
544
544
variant_ty
545
545
} else {
546
546
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) ;
548
548
}
549
549
return self . tcx . types . err ;
550
550
} ;
@@ -607,7 +607,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
607
607
let tcx = self . tcx ;
608
608
let on_error = || {
609
609
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) ;
611
611
}
612
612
} ;
613
613
let report_unexpected_res = |res : Res | {
@@ -677,7 +677,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
677
677
} ;
678
678
for ( i, subpat) in subpats. iter ( ) . enumerate_and_adjust ( variant. fields . len ( ) , ddpos) {
679
679
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) ;
681
681
682
682
self . tcx . check_stability ( variant. fields [ i] . did , Some ( pat. hir_id ) , subpat. span ) ;
683
683
}
@@ -734,17 +734,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
734
734
// further errors being emitted when using the bindings. #50333
735
735
let element_tys_iter = ( 0 ..max_len) . map ( |_| tcx. types . err ) ;
736
736
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) ;
738
738
}
739
739
tcx. mk_tup ( element_tys_iter)
740
740
} else {
741
741
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) ;
748
743
}
749
744
pat_ty
750
745
}
@@ -813,7 +808,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
813
808
}
814
809
} ;
815
810
816
- self . check_pat_walk ( & field. pat , field_ty, def_bm, None ) ;
811
+ self . check_pat ( & field. pat , field_ty, def_bm, None ) ;
817
812
}
818
813
let mut unmentioned_fields = variant. fields
819
814
. iter ( )
@@ -941,13 +936,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
941
936
942
937
if self . check_dereferencable ( span, expected, & inner) {
943
938
// 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`.
946
940
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) ;
948
942
uniq_ty
949
943
} 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) ;
951
945
tcx. types . err
952
946
}
953
947
}
@@ -998,10 +992,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
998
992
}
999
993
} ;
1000
994
1001
- self . check_pat_walk ( & inner, inner_ty, def_bm, discrim_span) ;
995
+ self . check_pat ( & inner, inner_ty, def_bm, discrim_span) ;
1002
996
rptr_ty
1003
997
} 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) ;
1005
999
tcx. types . err
1006
1000
}
1007
1001
}
@@ -1079,13 +1073,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1079
1073
} ;
1080
1074
1081
1075
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) ;
1083
1077
}
1084
1078
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) ;
1086
1080
}
1087
1081
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) ;
1089
1083
}
1090
1084
expected_ty
1091
1085
}
0 commit comments