@@ -302,9 +302,7 @@ impl MutabilityCategory {
302
302
ret
303
303
}
304
304
305
- fn from_local < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
306
- id : ast:: NodeId )
307
- -> MutabilityCategory {
305
+ fn from_local ( tcx : TyCtxt , id : ast:: NodeId ) -> MutabilityCategory {
308
306
let ret = match tcx. map . get ( id) {
309
307
ast_map:: NodeLocal ( p) => match p. node {
310
308
PatKind :: Ident ( bind_mode, _, _) => {
@@ -360,13 +358,13 @@ impl MutabilityCategory {
360
358
}
361
359
}
362
360
363
- impl < ' a , ' tcx > MemCategorizationContext < ' a , ' tcx , ' tcx > {
364
- pub fn new ( infcx : & ' a InferCtxt < ' a , ' tcx , ' tcx > )
365
- -> MemCategorizationContext < ' a , ' tcx , ' tcx > {
361
+ impl < ' a , ' gcx , ' tcx > MemCategorizationContext < ' a , ' gcx , ' tcx > {
362
+ pub fn new ( infcx : & ' a InferCtxt < ' a , ' gcx , ' tcx > )
363
+ -> MemCategorizationContext < ' a , ' gcx , ' tcx > {
366
364
MemCategorizationContext { infcx : infcx }
367
365
}
368
366
369
- fn tcx ( & self ) -> TyCtxt < ' a , ' tcx , ' tcx > {
367
+ fn tcx ( & self ) -> TyCtxt < ' a , ' gcx , ' tcx > {
370
368
self . infcx . tcx
371
369
}
372
370
@@ -1074,9 +1072,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
1074
1072
slice_pat : & hir:: Pat )
1075
1073
-> McResult < ( cmt < ' tcx > , hir:: Mutability , ty:: Region ) > {
1076
1074
let slice_ty = self . node_ty ( slice_pat. id ) ?;
1077
- let ( slice_mutbl, slice_r) = vec_slice_info ( self . tcx ( ) ,
1078
- slice_pat,
1079
- slice_ty) ;
1075
+ let ( slice_mutbl, slice_r) = vec_slice_info ( slice_pat, slice_ty) ;
1080
1076
let context = InteriorOffsetKind :: Pattern ;
1081
1077
let cmt_vec = self . deref_vec ( slice_pat, vec_cmt, context) ?;
1082
1078
let cmt_slice = self . cat_index ( slice_pat, cmt_vec, context) ?;
@@ -1085,14 +1081,12 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
1085
1081
/// In a pattern like [a, b, ..c], normally `c` has slice type, but if you have [a, b,
1086
1082
/// ..ref c], then the type of `ref c` will be `&&[]`, so to extract the slice details we
1087
1083
/// have to recurse through rptrs.
1088
- fn vec_slice_info < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1089
- pat : & hir:: Pat ,
1090
- slice_ty : Ty )
1091
- -> ( hir:: Mutability , ty:: Region ) {
1084
+ fn vec_slice_info ( pat : & hir:: Pat , slice_ty : Ty )
1085
+ -> ( hir:: Mutability , ty:: Region ) {
1092
1086
match slice_ty. sty {
1093
1087
ty:: TyRef ( r, ref mt) => match mt. ty . sty {
1094
1088
ty:: TySlice ( _) => ( mt. mutbl , * r) ,
1095
- _ => vec_slice_info ( tcx , pat, mt. ty ) ,
1089
+ _ => vec_slice_info ( pat, mt. ty ) ,
1096
1090
} ,
1097
1091
1098
1092
_ => {
@@ -1140,15 +1134,15 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
1140
1134
}
1141
1135
1142
1136
pub fn cat_pattern < F > ( & self , cmt : cmt < ' tcx > , pat : & hir:: Pat , mut op : F ) -> McResult < ( ) >
1143
- where F : FnMut ( & MemCategorizationContext < ' a , ' tcx , ' tcx > , cmt < ' tcx > , & hir:: Pat ) ,
1137
+ where F : FnMut ( & MemCategorizationContext < ' a , ' gcx , ' tcx > , cmt < ' tcx > , & hir:: Pat ) ,
1144
1138
{
1145
1139
self . cat_pattern_ ( cmt, pat, & mut op)
1146
1140
}
1147
1141
1148
1142
// FIXME(#19596) This is a workaround, but there should be a better way to do this
1149
1143
fn cat_pattern_ < F > ( & self , cmt : cmt < ' tcx > , pat : & hir:: Pat , op : & mut F )
1150
1144
-> McResult < ( ) >
1151
- where F : FnMut ( & MemCategorizationContext < ' a , ' tcx , ' tcx > , cmt < ' tcx > , & hir:: Pat ) ,
1145
+ where F : FnMut ( & MemCategorizationContext < ' a , ' gcx , ' tcx > , cmt < ' tcx > , & hir:: Pat ) ,
1152
1146
{
1153
1147
// Here, `cmt` is the categorization for the value being
1154
1148
// matched and pat is the pattern it is being matched against.
@@ -1466,7 +1460,7 @@ impl<'tcx> cmt_<'tcx> {
1466
1460
}
1467
1461
1468
1462
1469
- pub fn descriptive_string < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> String {
1463
+ pub fn descriptive_string ( & self , tcx : TyCtxt ) -> String {
1470
1464
match self . cat {
1471
1465
Categorization :: StaticItem => {
1472
1466
"static item" . to_string ( )
0 commit comments