@@ -86,6 +86,7 @@ use astconv::AstConv;
86
86
use check:: dropck;
87
87
use check:: FnCtxt ;
88
88
use middle:: free_region:: FreeRegionMap ;
89
+ use middle:: infer:: InferCtxt ;
89
90
use middle:: implicator;
90
91
use middle:: mem_categorization as mc;
91
92
use middle:: region:: CodeExtent ;
@@ -353,7 +354,7 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
353
354
debug ! ( "relate_free_regions(t={:?})" , ty) ;
354
355
let body_scope = CodeExtent :: from_node_id ( body_id) ;
355
356
let body_scope = ty:: ReScope ( body_scope) ;
356
- let implications = implicator:: implications ( self . fcx . infcx ( ) , self . fcx , body_id,
357
+ let implications = implicator:: implications ( self . fcx . infcx ( ) , self . fcx . infcx ( ) , body_id,
357
358
ty, body_scope, span) ;
358
359
359
360
// Record any relations between free regions that we observe into the free-region-map.
@@ -549,7 +550,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
549
550
// If necessary, constrain destructors in the unadjusted form of this
550
551
// expression.
551
552
let cmt_result = {
552
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
553
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
553
554
mc. cat_expr_unadjusted ( expr)
554
555
} ;
555
556
match cmt_result {
@@ -568,7 +569,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
568
569
// If necessary, constrain destructors in this expression. This will be
569
570
// the adjusted form if there is an adjustment.
570
571
let cmt_result = {
571
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
572
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
572
573
mc. cat_expr ( expr)
573
574
} ;
574
575
match cmt_result {
@@ -912,7 +913,7 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
912
913
r, m) ;
913
914
914
915
{
915
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
916
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
916
917
let self_cmt = ignore_err ! ( mc. cat_expr_autoderefd( deref_expr, i) ) ;
917
918
debug ! ( "constrain_autoderefs: self_cmt={:?}" ,
918
919
self_cmt) ;
@@ -1037,7 +1038,7 @@ fn link_addr_of(rcx: &mut Rcx, expr: &ast::Expr,
1037
1038
debug ! ( "link_addr_of(expr={:?}, base={:?})" , expr, base) ;
1038
1039
1039
1040
let cmt = {
1040
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1041
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
1041
1042
ignore_err ! ( mc. cat_expr( base) )
1042
1043
} ;
1043
1044
@@ -1055,7 +1056,7 @@ fn link_local(rcx: &Rcx, local: &ast::Local) {
1055
1056
None => { return ; }
1056
1057
Some ( ref expr) => & * * expr,
1057
1058
} ;
1058
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1059
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
1059
1060
let discr_cmt = ignore_err ! ( mc. cat_expr( init_expr) ) ;
1060
1061
link_pattern ( rcx, mc, discr_cmt, & * local. pat ) ;
1061
1062
}
@@ -1065,7 +1066,7 @@ fn link_local(rcx: &Rcx, local: &ast::Local) {
1065
1066
/// linked to the lifetime of its guarantor (if any).
1066
1067
fn link_match ( rcx : & Rcx , discr : & ast:: Expr , arms : & [ ast:: Arm ] ) {
1067
1068
debug ! ( "regionck::for_match()" ) ;
1068
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1069
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
1069
1070
let discr_cmt = ignore_err ! ( mc. cat_expr( discr) ) ;
1070
1071
debug ! ( "discr_cmt={:?}" , discr_cmt) ;
1071
1072
for arm in arms {
@@ -1080,7 +1081,7 @@ fn link_match(rcx: &Rcx, discr: &ast::Expr, arms: &[ast::Arm]) {
1080
1081
/// linked to the lifetime of its guarantor (if any).
1081
1082
fn link_fn_args ( rcx : & Rcx , body_scope : CodeExtent , args : & [ ast:: Arg ] ) {
1082
1083
debug ! ( "regionck::link_fn_args(body_scope={:?})" , body_scope) ;
1083
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1084
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
1084
1085
for arg in args {
1085
1086
let arg_ty = rcx. fcx . node_ty ( arg. id ) ;
1086
1087
let re_scope = ty:: ReScope ( body_scope) ;
@@ -1095,7 +1096,7 @@ fn link_fn_args(rcx: &Rcx, body_scope: CodeExtent, args: &[ast::Arg]) {
1095
1096
/// Link lifetimes of any ref bindings in `root_pat` to the pointers found in the discriminant, if
1096
1097
/// needed.
1097
1098
fn link_pattern < ' a , ' tcx > ( rcx : & Rcx < ' a , ' tcx > ,
1098
- mc : mc:: MemCategorizationContext < FnCtxt < ' a , ' tcx > > ,
1099
+ mc : mc:: MemCategorizationContext < InferCtxt < ' a , ' tcx > > ,
1099
1100
discr_cmt : mc:: cmt < ' tcx > ,
1100
1101
root_pat : & ast:: Pat ) {
1101
1102
debug ! ( "link_pattern(discr_cmt={:?}, root_pat={:?})" ,
@@ -1134,7 +1135,7 @@ fn link_autoref(rcx: &Rcx,
1134
1135
autoref : & ty:: AutoRef )
1135
1136
{
1136
1137
debug ! ( "link_autoref(autoref={:?})" , autoref) ;
1137
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1138
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
1138
1139
let expr_cmt = ignore_err ! ( mc. cat_expr_autoderefd( expr, autoderefs) ) ;
1139
1140
debug ! ( "expr_cmt={:?}" , expr_cmt) ;
1140
1141
@@ -1158,7 +1159,7 @@ fn link_by_ref(rcx: &Rcx,
1158
1159
callee_scope : CodeExtent ) {
1159
1160
debug ! ( "link_by_ref(expr={:?}, callee_scope={:?})" ,
1160
1161
expr, callee_scope) ;
1161
- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1162
+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
1162
1163
let expr_cmt = ignore_err ! ( mc. cat_expr( expr) ) ;
1163
1164
let borrow_region = ty:: ReScope ( callee_scope) ;
1164
1165
link_region ( rcx, expr. span , & borrow_region, ty:: ImmBorrow , expr_cmt) ;
@@ -1402,7 +1403,7 @@ pub fn type_must_outlive<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
1402
1403
ty,
1403
1404
region) ;
1404
1405
1405
- let implications = implicator:: implications ( rcx. fcx . infcx ( ) , rcx. fcx , rcx. body_id ,
1406
+ let implications = implicator:: implications ( rcx. fcx . infcx ( ) , rcx. fcx . infcx ( ) , rcx. body_id ,
1406
1407
ty, region, origin. span ( ) ) ;
1407
1408
for implication in implications {
1408
1409
debug ! ( "implication: {:?}" , implication) ;
@@ -1443,7 +1444,7 @@ fn closure_must_outlive<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
1443
1444
debug ! ( "closure_must_outlive(region={:?}, def_id={:?}, substs={:?})" ,
1444
1445
region, def_id, substs) ;
1445
1446
1446
- let upvars = rcx. fcx . closure_upvars ( def_id, substs) . unwrap ( ) ;
1447
+ let upvars = rcx. fcx . infcx ( ) . closure_upvars ( def_id, substs) . unwrap ( ) ;
1447
1448
for upvar in upvars {
1448
1449
let var_id = upvar. def . def_id ( ) . local_id ( ) ;
1449
1450
type_must_outlive (
0 commit comments