@@ -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) ;
@@ -1053,15 +1106,15 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1053
1106
}
1054
1107
}
1055
1108
1056
- fn node_ty ( & self , hir_id : HirId ) -> McResult < Ty < ' tcx > > {
1109
+ fn node_ty ( & self , hir_id : HirId ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1057
1110
self . resolve_type_vars_or_error ( hir_id, self . cx . typeck_results ( ) . node_type_opt ( hir_id) )
1058
1111
}
1059
1112
1060
- fn expr_ty ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < Ty < ' tcx > > {
1113
+ fn expr_ty ( & self , expr : & hir:: Expr < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1061
1114
self . resolve_type_vars_or_error ( expr. hir_id , self . cx . typeck_results ( ) . expr_ty_opt ( expr) )
1062
1115
}
1063
1116
1064
- fn expr_ty_adjusted ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < Ty < ' tcx > > {
1117
+ fn expr_ty_adjusted ( & self , expr : & hir:: Expr < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1065
1118
self . resolve_type_vars_or_error (
1066
1119
expr. hir_id ,
1067
1120
self . cx . typeck_results ( ) . expr_ty_adjusted_opt ( expr) ,
@@ -1078,7 +1131,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1078
1131
/// implicit deref patterns attached (e.g., it is really
1079
1132
/// `&Some(x)`). In that case, we return the "outermost" type
1080
1133
/// (e.g., `&Option<T>`).
1081
- fn pat_ty_adjusted ( & self , pat : & hir:: Pat < ' _ > ) -> McResult < Ty < ' tcx > > {
1134
+ fn pat_ty_adjusted ( & self , pat : & hir:: Pat < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1082
1135
// Check for implicit `&` types wrapping the pattern; note
1083
1136
// that these are never attached to binding patterns, so
1084
1137
// actually this is somewhat "disjoint" from the code below
@@ -1093,8 +1146,8 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1093
1146
self . pat_ty_unadjusted ( pat)
1094
1147
}
1095
1148
1096
- /// Like `pat_ty`, but ignores implicit `&` patterns.
1097
- fn pat_ty_unadjusted ( & self , pat : & hir:: Pat < ' _ > ) -> McResult < Ty < ' tcx > > {
1149
+ /// Like `TypeckResults:: pat_ty`, but ignores implicit `&` patterns.
1150
+ fn pat_ty_unadjusted ( & self , pat : & hir:: Pat < ' _ > ) -> Result < Ty < ' tcx > , ErrorGuaranteed > {
1098
1151
let base_ty = self . node_ty ( pat. hir_id ) ?;
1099
1152
trace ! ( ?base_ty) ;
1100
1153
@@ -1136,7 +1189,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1136
1189
}
1137
1190
}
1138
1191
1139
- fn cat_expr ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < PlaceWithHirId < ' tcx > > {
1192
+ fn cat_expr ( & self , expr : & hir:: Expr < ' _ > ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1140
1193
self . cat_expr_ ( expr, self . cx . typeck_results ( ) . expr_adjustments ( expr) )
1141
1194
}
1142
1195
@@ -1146,7 +1199,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1146
1199
& self ,
1147
1200
expr : & hir:: Expr < ' _ > ,
1148
1201
adjustments : & [ adjustment:: Adjustment < ' tcx > ] ,
1149
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1202
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1150
1203
match adjustments. split_last ( ) {
1151
1204
None => self . cat_expr_unadjusted ( expr) ,
1152
1205
Some ( ( adjustment, previous) ) => {
@@ -1160,7 +1213,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1160
1213
expr : & hir:: Expr < ' _ > ,
1161
1214
previous : PlaceWithHirId < ' tcx > ,
1162
1215
adjustment : & adjustment:: Adjustment < ' tcx > ,
1163
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1216
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1164
1217
self . cat_expr_adjusted_with ( expr, || Ok ( previous) , adjustment)
1165
1218
}
1166
1219
@@ -1169,9 +1222,9 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1169
1222
expr : & hir:: Expr < ' _ > ,
1170
1223
previous : F ,
1171
1224
adjustment : & adjustment:: Adjustment < ' tcx > ,
1172
- ) -> McResult < PlaceWithHirId < ' tcx > >
1225
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed >
1173
1226
where
1174
- F : FnOnce ( ) -> McResult < PlaceWithHirId < ' tcx > > ,
1227
+ F : FnOnce ( ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > ,
1175
1228
{
1176
1229
let target = self . cx . resolve_vars_if_possible ( adjustment. target ) ;
1177
1230
match adjustment. kind {
@@ -1196,7 +1249,10 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1196
1249
}
1197
1250
}
1198
1251
1199
- fn cat_expr_unadjusted ( & self , expr : & hir:: Expr < ' _ > ) -> McResult < PlaceWithHirId < ' tcx > > {
1252
+ fn cat_expr_unadjusted (
1253
+ & self ,
1254
+ expr : & hir:: Expr < ' _ > ,
1255
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1200
1256
let expr_ty = self . expr_ty ( expr) ?;
1201
1257
match expr. kind {
1202
1258
hir:: ExprKind :: Unary ( hir:: UnOp :: Deref , e_base) => {
@@ -1287,7 +1343,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1287
1343
span : Span ,
1288
1344
expr_ty : Ty < ' tcx > ,
1289
1345
res : Res ,
1290
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1346
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1291
1347
match res {
1292
1348
Res :: Def (
1293
1349
DefKind :: Ctor ( ..)
@@ -1321,7 +1377,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1321
1377
/// Note: the actual upvar access contains invisible derefs of closure
1322
1378
/// environment and upvar reference as appropriate. Only regionck cares
1323
1379
/// about these dereferences, so we let it compute them as needed.
1324
- fn cat_upvar ( & self , hir_id : HirId , var_id : HirId ) -> McResult < PlaceWithHirId < ' tcx > > {
1380
+ fn cat_upvar (
1381
+ & self ,
1382
+ hir_id : HirId ,
1383
+ var_id : HirId ,
1384
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1325
1385
let closure_expr_def_id = self . cx . body_owner_def_id ( ) ;
1326
1386
1327
1387
let upvar_id = ty:: UpvarId {
@@ -1370,7 +1430,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1370
1430
& self ,
1371
1431
expr : & hir:: Expr < ' _ > ,
1372
1432
base : & hir:: Expr < ' _ > ,
1373
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1433
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1374
1434
// Reconstruct the output assuming it's a reference with the
1375
1435
// same region and mutability as the receiver. This holds for
1376
1436
// `Deref(Mut)::Deref(_mut)` and `Index(Mut)::index(_mut)`.
@@ -1392,7 +1452,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1392
1452
& self ,
1393
1453
node : HirId ,
1394
1454
base_place : PlaceWithHirId < ' tcx > ,
1395
- ) -> McResult < PlaceWithHirId < ' tcx > > {
1455
+ ) -> Result < PlaceWithHirId < ' tcx > , ErrorGuaranteed > {
1396
1456
let base_curr_ty = base_place. place . ty ( ) ;
1397
1457
let deref_ty = match self
1398
1458
. cx
@@ -1417,26 +1477,14 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1417
1477
Ok ( PlaceWithHirId :: new ( node, base_place. place . base_ty , base_place. place . base , projections) )
1418
1478
}
1419
1479
1420
- fn cat_pattern < F > (
1421
- & self ,
1422
- place : PlaceWithHirId < ' tcx > ,
1423
- pat : & hir:: Pat < ' _ > ,
1424
- mut op : F ,
1425
- ) -> McResult < ( ) >
1426
- where
1427
- F : FnMut ( & PlaceWithHirId < ' tcx > , & hir:: Pat < ' _ > ) ,
1428
- {
1429
- self . cat_pattern_ ( place, pat, & mut op)
1430
- }
1431
-
1432
1480
/// Returns the variant index for an ADT used within a Struct or TupleStruct pattern
1433
1481
/// Here `pat_hir_id` is the HirId of the pattern itself.
1434
1482
fn variant_index_for_adt (
1435
1483
& self ,
1436
1484
qpath : & hir:: QPath < ' _ > ,
1437
1485
pat_hir_id : HirId ,
1438
1486
span : Span ,
1439
- ) -> McResult < VariantIdx > {
1487
+ ) -> Result < VariantIdx , ErrorGuaranteed > {
1440
1488
let res = self . cx . typeck_results ( ) . qpath_res ( qpath, pat_hir_id) ;
1441
1489
let ty = self . cx . typeck_results ( ) . node_type ( pat_hir_id) ;
1442
1490
let ty:: Adt ( adt_def, _) = self . cx . try_structurally_resolve_type ( span, ty) . kind ( ) else {
@@ -1471,7 +1519,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1471
1519
pat_hir_id : HirId ,
1472
1520
variant_index : VariantIdx ,
1473
1521
span : Span ,
1474
- ) -> McResult < usize > {
1522
+ ) -> Result < usize , ErrorGuaranteed > {
1475
1523
let ty = self . cx . typeck_results ( ) . node_type ( pat_hir_id) ;
1476
1524
match self . cx . try_structurally_resolve_type ( span, ty) . kind ( ) {
1477
1525
ty:: Adt ( adt_def, _) => Ok ( adt_def. variant ( variant_index) . fields . len ( ) ) ,
@@ -1486,7 +1534,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1486
1534
1487
1535
/// Returns the total number of fields in a tuple used within a Tuple pattern.
1488
1536
/// Here `pat_hir_id` is the HirId of the pattern itself.
1489
- fn total_fields_in_tuple ( & self , pat_hir_id : HirId , span : Span ) -> McResult < usize > {
1537
+ fn total_fields_in_tuple (
1538
+ & self ,
1539
+ pat_hir_id : HirId ,
1540
+ span : Span ,
1541
+ ) -> Result < usize , ErrorGuaranteed > {
1490
1542
let ty = self . cx . typeck_results ( ) . node_type ( pat_hir_id) ;
1491
1543
match self . cx . try_structurally_resolve_type ( span, ty) . kind ( ) {
1492
1544
ty:: Tuple ( args) => Ok ( args. len ( ) ) ,
@@ -1504,12 +1556,12 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1504
1556
/// In general, the way that this works is that we walk down the pattern,
1505
1557
/// constructing a `PlaceWithHirId` that represents the path that will be taken
1506
1558
/// to reach the value being matched.
1507
- fn cat_pattern_ < F > (
1559
+ fn cat_pattern < F > (
1508
1560
& self ,
1509
1561
mut place_with_id : PlaceWithHirId < ' tcx > ,
1510
1562
pat : & hir:: Pat < ' _ > ,
1511
1563
op : & mut F ,
1512
- ) -> McResult < ( ) >
1564
+ ) -> Result < ( ) , ErrorGuaranteed >
1513
1565
where
1514
1566
F : FnMut ( & PlaceWithHirId < ' tcx > , & hir:: Pat < ' _ > ) ,
1515
1567
{
@@ -1580,7 +1632,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1580
1632
subpat_ty,
1581
1633
projection_kind,
1582
1634
) ;
1583
- self . cat_pattern_ ( sub_place, subpat, op) ?;
1635
+ self . cat_pattern ( sub_place, subpat, op) ?;
1584
1636
}
1585
1637
}
1586
1638
@@ -1600,7 +1652,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1600
1652
subpat_ty,
1601
1653
projection_kind,
1602
1654
) ;
1603
- self . cat_pattern_ ( sub_place, subpat, op) ?;
1655
+ self . cat_pattern ( sub_place, subpat, op) ?;
1604
1656
}
1605
1657
}
1606
1658
@@ -1625,26 +1677,26 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1625
1677
field_ty,
1626
1678
ProjectionKind :: Field ( field_index, variant_index) ,
1627
1679
) ;
1628
- self . cat_pattern_ ( field_place, fp. pat , op) ?;
1680
+ self . cat_pattern ( field_place, fp. pat , op) ?;
1629
1681
}
1630
1682
}
1631
1683
1632
1684
PatKind :: Or ( pats) => {
1633
1685
for pat in pats {
1634
- self . cat_pattern_ ( place_with_id. clone ( ) , pat, op) ?;
1686
+ self . cat_pattern ( place_with_id. clone ( ) , pat, op) ?;
1635
1687
}
1636
1688
}
1637
1689
1638
1690
PatKind :: Binding ( .., Some ( subpat) ) => {
1639
- self . cat_pattern_ ( place_with_id, subpat, op) ?;
1691
+ self . cat_pattern ( place_with_id, subpat, op) ?;
1640
1692
}
1641
1693
1642
1694
PatKind :: Box ( subpat) | PatKind :: Ref ( subpat, _) => {
1643
1695
// box p1, &p1, &mut p1. we can ignore the mutability of
1644
1696
// PatKind::Ref since that information is already contained
1645
1697
// in the type.
1646
1698
let subplace = self . cat_deref ( pat. hir_id , place_with_id) ?;
1647
- self . cat_pattern_ ( subplace, subpat, op) ?;
1699
+ self . cat_pattern ( subplace, subpat, op) ?;
1648
1700
}
1649
1701
PatKind :: Deref ( subpat) => {
1650
1702
let mutable = self . cx . typeck_results ( ) . pat_has_ref_mut_binding ( subpat) ;
@@ -1654,7 +1706,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1654
1706
let ty = Ty :: new_ref ( self . cx . tcx ( ) , re_erased, ty, mutability) ;
1655
1707
// A deref pattern generates a temporary.
1656
1708
let place = self . cat_rvalue ( pat. hir_id , ty) ;
1657
- self . cat_pattern_ ( place, subpat, op) ?;
1709
+ self . cat_pattern ( place, subpat, op) ?;
1658
1710
}
1659
1711
1660
1712
PatKind :: Slice ( before, ref slice, after) => {
@@ -1673,7 +1725,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1673
1725
ProjectionKind :: Index ,
1674
1726
) ;
1675
1727
for before_pat in before {
1676
- self . cat_pattern_ ( elt_place. clone ( ) , before_pat, op) ?;
1728
+ self . cat_pattern ( elt_place. clone ( ) , before_pat, op) ?;
1677
1729
}
1678
1730
if let Some ( slice_pat) = * slice {
1679
1731
let slice_pat_ty = self . pat_ty_adjusted ( slice_pat) ?;
@@ -1683,10 +1735,10 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
1683
1735
slice_pat_ty,
1684
1736
ProjectionKind :: Subslice ,
1685
1737
) ;
1686
- self . cat_pattern_ ( slice_place, slice_pat, op) ?;
1738
+ self . cat_pattern ( slice_place, slice_pat, op) ?;
1687
1739
}
1688
1740
for after_pat in after {
1689
- self . cat_pattern_ ( elt_place. clone ( ) , after_pat, op) ?;
1741
+ self . cat_pattern ( elt_place. clone ( ) , after_pat, op) ?;
1690
1742
}
1691
1743
}
1692
1744
0 commit comments