@@ -30,8 +30,6 @@ use ty::BorrowKind::ImmBorrow;
30
30
31
31
use crate :: fn_ctxt:: FnCtxt ;
32
32
33
- type McResult < T > = Result < T , ErrorGuaranteed > ;
34
-
35
33
/// This trait defines the callbacks you can expect to receive when
36
34
/// employing the ExprUseVisitor.
37
35
pub trait Delegate < ' tcx > {
@@ -219,6 +217,8 @@ impl<'tcx> TypeInformationCtxt<'tcx> for (&LateContext<'tcx>, LocalDefId) {
219
217
/// This is the code that actually walks the tree.
220
218
pub struct ExprUseVisitor < ' tcx , Cx : TypeInformationCtxt < ' tcx > , D : Delegate < ' tcx > > {
221
219
cx : Cx ,
220
+ /// We use a `RefCell` here so that delegates can mutate themselves, but we can
221
+ /// still have calls to our own helper functions.
222
222
delegate : RefCell < D > ,
223
223
upvars : Option < & ' tcx FxIndexMap < HirId , hir:: Upvar > > ,
224
224
}
@@ -517,14 +517,14 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
517
517
discr : & Expr < ' _ > ,
518
518
discr_place : PlaceWithHirId < ' tcx > ,
519
519
pats : impl Iterator < Item = & ' t hir:: Pat < ' t > > ,
520
- ) -> McResult < ( ) > {
520
+ ) -> Result < ( ) , ErrorGuaranteed > {
521
521
// Matching should not always be considered a use of the place, hence
522
522
// discr does not necessarily need to be borrowed.
523
523
// We only want to borrow discr if the pattern contain something other
524
524
// than wildcards.
525
525
let mut needs_to_be_read = false ;
526
526
for pat in pats {
527
- self . cat_pattern ( discr_place. clone ( ) , pat, |place, pat| {
527
+ self . cat_pattern ( discr_place. clone ( ) , pat, & mut |place, pat| {
528
528
match & pat. kind {
529
529
PatKind :: Binding ( .., opt_sub_pat) => {
530
530
// If the opt_sub_pat is None, then the binding does not count as
@@ -836,7 +836,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
836
836
debug ! ( "walk_pat(discr_place={:?}, pat={:?}, has_guard={:?})" , discr_place, pat, has_guard) ;
837
837
838
838
let tcx = self . cx . tcx ( ) ;
839
- return_if_err ! ( self . cat_pattern( discr_place. clone( ) , pat, |place, pat| {
839
+ return_if_err ! ( self . cat_pattern( discr_place. clone( ) , pat, & mut |place, pat| {
840
840
if let PatKind :: Binding ( _, canonical_id, ..) = pat. kind {
841
841
debug!( "walk_pat: binding place={:?} pat={:?}" , place, pat) ;
842
842
if let Some ( bm) =
@@ -1021,8 +1021,61 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1021
1021
}
1022
1022
}
1023
1023
}
1024
+ }
1024
1025
1025
- fn resolve_type_vars_or_error ( & self , id : HirId , ty : Option < Ty < ' tcx > > ) -> McResult < Ty < ' tcx > > {
1026
+ /// The job of the categorization methods is to analyze an expression to
1027
+ /// determine what kind of memory is used in evaluating it (for example,
1028
+ /// where dereferences occur and what kind of pointer is dereferenced;
1029
+ /// whether the memory is mutable, etc.).
1030
+ ///
1031
+ /// Categorization effectively transforms all of our expressions into
1032
+ /// expressions of the following forms (the actual enum has many more
1033
+ /// possibilities, naturally, but they are all variants of these base
1034
+ /// forms):
1035
+ /// ```ignore (not-rust)
1036
+ /// E = rvalue // some computed rvalue
1037
+ /// | x // address of a local variable or argument
1038
+ /// | *E // deref of a ptr
1039
+ /// | E.comp // access to an interior component
1040
+ /// ```
1041
+ /// Imagine a routine ToAddr(Expr) that evaluates an expression and returns an
1042
+ /// address where the result is to be found. If Expr is a place, then this
1043
+ /// is the address of the place. If `Expr` is an rvalue, this is the address of
1044
+ /// some temporary spot in memory where the result is stored.
1045
+ ///
1046
+ /// Now, `cat_expr()` classifies the expression `Expr` and the address `A = ToAddr(Expr)`
1047
+ /// as follows:
1048
+ ///
1049
+ /// - `cat`: what kind of expression was this? This is a subset of the
1050
+ /// full expression forms which only includes those that we care about
1051
+ /// for the purpose of the analysis.
1052
+ /// - `mutbl`: mutability of the address `A`.
1053
+ /// - `ty`: the type of data found at the address `A`.
1054
+ ///
1055
+ /// The resulting categorization tree differs somewhat from the expressions
1056
+ /// themselves. For example, auto-derefs are explicit. Also, an index `a[b]` is
1057
+ /// decomposed into two operations: a dereference to reach the array data and
1058
+ /// then an index to jump forward to the relevant item.
1059
+ ///
1060
+ /// ## By-reference upvars
1061
+ ///
1062
+ /// One part of the codegen which may be non-obvious is that we translate
1063
+ /// closure upvars into the dereference of a borrowed pointer; this more closely
1064
+ /// resembles the runtime codegen. So, for example, if we had:
1065
+ ///
1066
+ /// let mut x = 3;
1067
+ /// let y = 5;
1068
+ /// let inc = || x += y;
1069
+ ///
1070
+ /// Then when we categorize `x` (*within* the closure) we would yield a
1071
+ /// result of `*x'`, effectively, where `x'` is a `Categorization::Upvar` reference
1072
+ /// tied to `x`. The type of `x'` will be a borrowed pointer.
1073
+ impl < ' tcx , Cx : TypeInformationCtxt < ' tcx > , D : Delegate < ' tcx > > ExprUseVisitor < ' tcx , Cx , D > {
1074
+ fn resolve_type_vars_or_error (
1075
+ & self ,
1076
+ id : HirId ,
1077
+ ty : Option < Ty < ' tcx > > ,
1078
+ ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1026
1079
match ty {
1027
1080
Some ( ty) => {
1028
1081
let ty = self . cx . resolve_vars_if_possible ( ty) ;
@@ -1051,15 +1104,15 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1051
1104
}
1052
1105
}
1053
1106
1054
- fn node_ty ( & self , hir_id : HirId ) -> McResult < Ty < ' tcx > > {
1107
+ fn node_ty ( & self , hir_id : HirId ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1055
1108
self . resolve_type_vars_or_error ( hir_id, self . cx . typeck_results ( ) . node_type_opt ( hir_id) )
1056
1109
}
1057
1110
1058
- fn expr_ty ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < Ty < ' tcx > > {
1111
+ fn expr_ty ( & self , expr : & hir:: Expr < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1059
1112
self . resolve_type_vars_or_error ( expr. hir_id , self . cx . typeck_results ( ) . expr_ty_opt ( expr) )
1060
1113
}
1061
1114
1062
- fn expr_ty_adjusted ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < Ty < ' tcx > > {
1115
+ fn expr_ty_adjusted ( & self , expr : & hir:: Expr < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1063
1116
self . resolve_type_vars_or_error (
1064
1117
expr. hir_id ,
1065
1118
self . cx . typeck_results ( ) . expr_ty_adjusted_opt ( expr) ,
@@ -1076,7 +1129,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1076
1129
/// implicit deref patterns attached (e.g., it is really
1077
1130
/// `&Some(x)`). In that case, we return the "outermost" type
1078
1131
/// (e.g., `&Option<T>`).
1079
- fn pat_ty_adjusted ( & self , pat : & hir:: Pat < ' _ > ) -> McResult < Ty < ' tcx > > {
1132
+ fn pat_ty_adjusted ( & self , pat : & hir:: Pat < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1080
1133
// Check for implicit `&` types wrapping the pattern; note
1081
1134
// that these are never attached to binding patterns, so
1082
1135
// actually this is somewhat "disjoint" from the code below
@@ -1091,8 +1144,8 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1091
1144
self . pat_ty_unadjusted ( pat)
1092
1145
}
1093
1146
1094
- /// Like `pat_ty`, but ignores implicit `&` patterns.
1095
- fn pat_ty_unadjusted ( & self , pat : & hir:: Pat < ' _ > ) -> McResult < Ty < ' tcx > > {
1147
+ /// Like `TypeckResults:: pat_ty`, but ignores implicit `&` patterns.
1148
+ fn pat_ty_unadjusted ( & self , pat : & hir:: Pat < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1096
1149
let base_ty = self . node_ty ( pat. hir_id ) ?;
1097
1150
trace ! ( ?base_ty) ;
1098
1151
@@ -1134,7 +1187,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1134
1187
}
1135
1188
}
1136
1189
1137
- fn cat_expr ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < PlaceWithHirId < ' tcx > > {
1190
+ fn cat_expr ( & self , expr : & hir:: Expr < ' _ > ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1138
1191
self . cat_expr_ ( expr, self . cx . typeck_results ( ) . expr_adjustments ( expr) )
1139
1192
}
1140
1193
@@ -1144,7 +1197,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1144
1197
& self ,
1145
1198
expr : & hir:: Expr < ' _ > ,
1146
1199
adjustments : & [ adjustment:: Adjustment < ' tcx > ] ,
1147
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1200
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1148
1201
match adjustments. split_last ( ) {
1149
1202
None => self . cat_expr_unadjusted ( expr) ,
1150
1203
Some ( ( adjustment, previous) ) => {
@@ -1158,7 +1211,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1158
1211
expr : & hir:: Expr < ' _ > ,
1159
1212
previous : PlaceWithHirId < ' tcx > ,
1160
1213
adjustment : & adjustment:: Adjustment < ' tcx > ,
1161
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1214
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1162
1215
self . cat_expr_adjusted_with ( expr, || Ok ( previous) , adjustment)
1163
1216
}
1164
1217
@@ -1167,9 +1220,9 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1167
1220
expr : & hir:: Expr < ' _ > ,
1168
1221
previous : F ,
1169
1222
adjustment : & adjustment:: Adjustment < ' tcx > ,
1170
- ) -> McResult < PlaceWithHirId < ' tcx > >
1223
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed >
1171
1224
where
1172
- F : FnOnce ( ) -> McResult < PlaceWithHirId < ' tcx > > ,
1225
+ F : FnOnce ( ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > ,
1173
1226
{
1174
1227
let target = self . cx . resolve_vars_if_possible ( adjustment. target ) ;
1175
1228
match adjustment. kind {
@@ -1194,7 +1247,10 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1194
1247
}
1195
1248
}
1196
1249
1197
- fn cat_expr_unadjusted ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < PlaceWithHirId < ' tcx > > {
1250
+ fn cat_expr_unadjusted (
1251
+ & self ,
1252
+ expr : & hir:: Expr < ' _ > ,
1253
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1198
1254
let expr_ty = self . expr_ty ( expr) ?;
1199
1255
match expr. kind {
1200
1256
hir:: ExprKind :: Unary ( hir:: UnOp :: Deref , e_base) => {
@@ -1285,7 +1341,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1285
1341
span : Span ,
1286
1342
expr_ty : Ty < ' tcx > ,
1287
1343
res : Res ,
1288
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1344
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1289
1345
match res {
1290
1346
Res :: Def (
1291
1347
DefKind :: Ctor ( ..)
@@ -1319,7 +1375,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1319
1375
/// Note: the actual upvar access contains invisible derefs of closure
1320
1376
/// environment and upvar reference as appropriate. Only regionck cares
1321
1377
/// about these dereferences, so we let it compute them as needed.
1322
- fn cat_upvar ( & self , hir_id : HirId , var_id : HirId ) -> McResult < PlaceWithHirId < ' tcx > > {
1378
+ fn cat_upvar (
1379
+ & self ,
1380
+ hir_id : HirId ,
1381
+ var_id : HirId ,
1382
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1323
1383
let closure_expr_def_id = self . cx . body_owner_def_id ( ) ;
1324
1384
1325
1385
let upvar_id = ty:: UpvarId {
@@ -1368,7 +1428,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1368
1428
& self ,
1369
1429
expr : & hir:: Expr < ' _ > ,
1370
1430
base : & hir:: Expr < ' _ > ,
1371
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1431
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1372
1432
// Reconstruct the output assuming it's a reference with the
1373
1433
// same region and mutability as the receiver. This holds for
1374
1434
// `Deref(Mut)::Deref(_mut)` and `Index(Mut)::index(_mut)`.
@@ -1390,7 +1450,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1390
1450
& self ,
1391
1451
node : HirId ,
1392
1452
base_place : PlaceWithHirId < ' tcx > ,
1393
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1453
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1394
1454
let base_curr_ty = base_place. place . ty ( ) ;
1395
1455
let deref_ty = match self
1396
1456
. cx
@@ -1415,26 +1475,14 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1415
1475
Ok ( PlaceWithHirId :: new ( node, base_place. place . base_ty , base_place. place . base , projections) )
1416
1476
}
1417
1477
1418
- fn cat_pattern < F > (
1419
- & self ,
1420
- place : PlaceWithHirId < ' tcx > ,
1421
- pat : & hir:: Pat < ' _ > ,
1422
- mut op : F ,
1423
- ) -> McResult < ( ) >
1424
- where
1425
- F : FnMut ( & PlaceWithHirId < ' tcx > , & hir:: Pat < ' _ > ) ,
1426
- {
1427
- self . cat_pattern_ ( place, pat, & mut op)
1428
- }
1429
-
1430
1478
/// Returns the variant index for an ADT used within a Struct or TupleStruct pattern
1431
1479
/// Here `pat_hir_id` is the HirId of the pattern itself.
1432
1480
fn variant_index_for_adt (
1433
1481
& self ,
1434
1482
qpath : & hir:: QPath < ' _ > ,
1435
1483
pat_hir_id : HirId ,
1436
1484
span : Span ,
1437
- ) -> McResult < VariantIdx > {
1485
+ ) -> Result < VariantIdx , ErrorGuaranteed > {
1438
1486
let res = self . cx . typeck_results ( ) . qpath_res ( qpath, pat_hir_id) ;
1439
1487
let ty = self . cx . typeck_results ( ) . node_type ( pat_hir_id) ;
1440
1488
let ty:: Adt ( adt_def, _) = self . cx . try_structurally_resolve_type ( span, ty) . kind ( ) else {
@@ -1469,7 +1517,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1469
1517
pat_hir_id : HirId ,
1470
1518
variant_index : VariantIdx ,
1471
1519
span : Span ,
1472
- ) -> McResult < usize > {
1520
+ ) -> Result < usize , ErrorGuaranteed > {
1473
1521
let ty = self . cx . typeck_results ( ) . node_type ( pat_hir_id) ;
1474
1522
match self . cx . try_structurally_resolve_type ( span, ty) . kind ( ) {
1475
1523
ty:: Adt ( adt_def, _) => Ok ( adt_def. variant ( variant_index) . fields . len ( ) ) ,
@@ -1484,7 +1532,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1484
1532
1485
1533
/// Returns the total number of fields in a tuple used within a Tuple pattern.
1486
1534
/// Here `pat_hir_id` is the HirId of the pattern itself.
1487
- fn total_fields_in_tuple ( & self , pat_hir_id : HirId , span : Span ) -> McResult < usize > {
1535
+ fn total_fields_in_tuple (
1536
+ & self ,
1537
+ pat_hir_id : HirId ,
1538
+ span : Span ,
1539
+ ) -> Result < usize , ErrorGuaranteed > {
1488
1540
let ty = self . cx . typeck_results ( ) . node_type ( pat_hir_id) ;
1489
1541
match self . cx . try_structurally_resolve_type ( span, ty) . kind ( ) {
1490
1542
ty:: Tuple ( args) => Ok ( args. len ( ) ) ,
@@ -1502,12 +1554,12 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1502
1554
/// In general, the way that this works is that we walk down the pattern,
1503
1555
/// constructing a `PlaceWithHirId` that represents the path that will be taken
1504
1556
/// to reach the value being matched.
1505
- fn cat_pattern_ < F > (
1557
+ fn cat_pattern < F > (
1506
1558
& self ,
1507
1559
mut place_with_id : PlaceWithHirId < ' tcx > ,
1508
1560
pat : & hir:: Pat < ' _ > ,
1509
1561
op : & mut F ,
1510
- ) -> McResult < ( ) >
1562
+ ) -> Result < ( ) , ErrorGuaranteed >
1511
1563
where
1512
1564
F : FnMut ( & PlaceWithHirId < ' tcx > , & hir:: Pat < ' _ > ) ,
1513
1565
{
@@ -1578,7 +1630,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1578
1630
subpat_ty,
1579
1631
projection_kind,
1580
1632
) ;
1581
- self . cat_pattern_ ( sub_place, subpat, op) ?;
1633
+ self . cat_pattern ( sub_place, subpat, op) ?;
1582
1634
}
1583
1635
}
1584
1636
@@ -1598,7 +1650,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1598
1650
subpat_ty,
1599
1651
projection_kind,
1600
1652
) ;
1601
- self . cat_pattern_ ( sub_place, subpat, op) ?;
1653
+ self . cat_pattern ( sub_place, subpat, op) ?;
1602
1654
}
1603
1655
}
1604
1656
@@ -1623,26 +1675,26 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1623
1675
field_ty,
1624
1676
ProjectionKind :: Field ( field_index, variant_index) ,
1625
1677
) ;
1626
- self . cat_pattern_ ( field_place, fp. pat , op) ?;
1678
+ self . cat_pattern ( field_place, fp. pat , op) ?;
1627
1679
}
1628
1680
}
1629
1681
1630
1682
PatKind :: Or ( pats) => {
1631
1683
for pat in pats {
1632
- self . cat_pattern_ ( place_with_id. clone ( ) , pat, op) ?;
1684
+ self . cat_pattern ( place_with_id. clone ( ) , pat, op) ?;
1633
1685
}
1634
1686
}
1635
1687
1636
1688
PatKind :: Binding ( .., Some ( subpat) ) => {
1637
- self . cat_pattern_ ( place_with_id, subpat, op) ?;
1689
+ self . cat_pattern ( place_with_id, subpat, op) ?;
1638
1690
}
1639
1691
1640
1692
PatKind :: Box ( subpat) | PatKind :: Ref ( subpat, _) => {
1641
1693
// box p1, &p1, &mut p1. we can ignore the mutability of
1642
1694
// PatKind::Ref since that information is already contained
1643
1695
// in the type.
1644
1696
let subplace = self . cat_deref ( pat. hir_id , place_with_id) ?;
1645
- self . cat_pattern_ ( subplace, subpat, op) ?;
1697
+ self . cat_pattern ( subplace, subpat, op) ?;
1646
1698
}
1647
1699
PatKind :: Deref ( subpat) => {
1648
1700
let mutable = self . cx . typeck_results ( ) . pat_has_ref_mut_binding ( subpat) ;
@@ -1652,7 +1704,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1652
1704
let ty = Ty :: new_ref ( self . cx . tcx ( ) , re_erased, ty, mutability) ;
1653
1705
// A deref pattern generates a temporary.
1654
1706
let place = self . cat_rvalue ( pat. hir_id , ty) ;
1655
- self . cat_pattern_ ( place, subpat, op) ?;
1707
+ self . cat_pattern ( place, subpat, op) ?;
1656
1708
}
1657
1709
1658
1710
PatKind :: Slice ( before, ref slice, after) => {
@@ -1671,7 +1723,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1671
1723
ProjectionKind :: Index ,
1672
1724
) ;
1673
1725
for before_pat in before {
1674
- self . cat_pattern_ ( elt_place. clone ( ) , before_pat, op) ?;
1726
+ self . cat_pattern ( elt_place. clone ( ) , before_pat, op) ?;
1675
1727
}
1676
1728
if let Some ( slice_pat) = * slice {
1677
1729
let slice_pat_ty = self . pat_ty_adjusted ( slice_pat) ?;
@@ -1681,10 +1733,10 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1681
1733
slice_pat_ty,
1682
1734
ProjectionKind :: Subslice ,
1683
1735
) ;
1684
- self . cat_pattern_ ( slice_place, slice_pat, op) ?;
1736
+ self . cat_pattern ( slice_place, slice_pat, op) ?;
1685
1737
}
1686
1738
for after_pat in after {
1687
- self . cat_pattern_ ( elt_place. clone ( ) , after_pat, op) ?;
1739
+ self . cat_pattern ( elt_place. clone ( ) , after_pat, op) ?;
1688
1740
}
1689
1741
}
1690
1742
0 commit comments