@@ -86,6 +86,7 @@ use astconv::AstConv;
8686use check:: dropck;
8787use check:: FnCtxt ;
8888use middle:: free_region:: FreeRegionMap ;
89+ use middle:: infer:: InferCtxt ;
8990use middle:: implicator;
9091use middle:: mem_categorization as mc;
9192use middle:: region:: CodeExtent ;
@@ -353,7 +354,7 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
353354 debug ! ( "relate_free_regions(t={:?})" , ty) ;
354355 let body_scope = CodeExtent :: from_node_id ( body_id) ;
355356 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,
357358 ty, body_scope, span) ;
358359
359360 // 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) {
549550 // If necessary, constrain destructors in the unadjusted form of this
550551 // expression.
551552 let cmt_result = {
552- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
553+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
553554 mc. cat_expr_unadjusted ( expr)
554555 } ;
555556 match cmt_result {
@@ -568,7 +569,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
568569 // If necessary, constrain destructors in this expression. This will be
569570 // the adjusted form if there is an adjustment.
570571 let cmt_result = {
571- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
572+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
572573 mc. cat_expr ( expr)
573574 } ;
574575 match cmt_result {
@@ -912,7 +913,7 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
912913 r, m) ;
913914
914915 {
915- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
916+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
916917 let self_cmt = ignore_err ! ( mc. cat_expr_autoderefd( deref_expr, i) ) ;
917918 debug ! ( "constrain_autoderefs: self_cmt={:?}" ,
918919 self_cmt) ;
@@ -1037,7 +1038,7 @@ fn link_addr_of(rcx: &mut Rcx, expr: &ast::Expr,
10371038 debug ! ( "link_addr_of(expr={:?}, base={:?})" , expr, base) ;
10381039
10391040 let cmt = {
1040- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1041+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
10411042 ignore_err ! ( mc. cat_expr( base) )
10421043 } ;
10431044
@@ -1055,7 +1056,7 @@ fn link_local(rcx: &Rcx, local: &ast::Local) {
10551056 None => { return ; }
10561057 Some ( ref expr) => & * * expr,
10571058 } ;
1058- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1059+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
10591060 let discr_cmt = ignore_err ! ( mc. cat_expr( init_expr) ) ;
10601061 link_pattern ( rcx, mc, discr_cmt, & * local. pat ) ;
10611062}
@@ -1065,7 +1066,7 @@ fn link_local(rcx: &Rcx, local: &ast::Local) {
10651066/// linked to the lifetime of its guarantor (if any).
10661067fn link_match ( rcx : & Rcx , discr : & ast:: Expr , arms : & [ ast:: Arm ] ) {
10671068 debug ! ( "regionck::for_match()" ) ;
1068- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1069+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
10691070 let discr_cmt = ignore_err ! ( mc. cat_expr( discr) ) ;
10701071 debug ! ( "discr_cmt={:?}" , discr_cmt) ;
10711072 for arm in arms {
@@ -1080,7 +1081,7 @@ fn link_match(rcx: &Rcx, discr: &ast::Expr, arms: &[ast::Arm]) {
10801081/// linked to the lifetime of its guarantor (if any).
10811082fn link_fn_args ( rcx : & Rcx , body_scope : CodeExtent , args : & [ ast:: Arg ] ) {
10821083 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 ( ) ) ;
10841085 for arg in args {
10851086 let arg_ty = rcx. fcx . node_ty ( arg. id ) ;
10861087 let re_scope = ty:: ReScope ( body_scope) ;
@@ -1095,7 +1096,7 @@ fn link_fn_args(rcx: &Rcx, body_scope: CodeExtent, args: &[ast::Arg]) {
10951096/// Link lifetimes of any ref bindings in `root_pat` to the pointers found in the discriminant, if
10961097/// needed.
10971098fn link_pattern < ' a , ' tcx > ( rcx : & Rcx < ' a , ' tcx > ,
1098- mc : mc:: MemCategorizationContext < FnCtxt < ' a , ' tcx > > ,
1099+ mc : mc:: MemCategorizationContext < InferCtxt < ' a , ' tcx > > ,
10991100 discr_cmt : mc:: cmt < ' tcx > ,
11001101 root_pat : & ast:: Pat ) {
11011102 debug ! ( "link_pattern(discr_cmt={:?}, root_pat={:?})" ,
@@ -1134,7 +1135,7 @@ fn link_autoref(rcx: &Rcx,
11341135 autoref : & ty:: AutoRef )
11351136{
11361137 debug ! ( "link_autoref(autoref={:?})" , autoref) ;
1137- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1138+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
11381139 let expr_cmt = ignore_err ! ( mc. cat_expr_autoderefd( expr, autoderefs) ) ;
11391140 debug ! ( "expr_cmt={:?}" , expr_cmt) ;
11401141
@@ -1158,7 +1159,7 @@ fn link_by_ref(rcx: &Rcx,
11581159 callee_scope : CodeExtent ) {
11591160 debug ! ( "link_by_ref(expr={:?}, callee_scope={:?})" ,
11601161 expr, callee_scope) ;
1161- let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
1162+ let mc = mc:: MemCategorizationContext :: new ( rcx. fcx . infcx ( ) ) ;
11621163 let expr_cmt = ignore_err ! ( mc. cat_expr( expr) ) ;
11631164 let borrow_region = ty:: ReScope ( callee_scope) ;
11641165 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>,
14021403 ty,
14031404 region) ;
14041405
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 ,
14061407 ty, region, origin. span ( ) ) ;
14071408 for implication in implications {
14081409 debug ! ( "implication: {:?}" , implication) ;
@@ -1443,7 +1444,7 @@ fn closure_must_outlive<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
14431444 debug ! ( "closure_must_outlive(region={:?}, def_id={:?}, substs={:?})" ,
14441445 region, def_id, substs) ;
14451446
1446- let upvars = rcx. fcx . closure_upvars ( def_id, substs) . unwrap ( ) ;
1447+ let upvars = rcx. fcx . infcx ( ) . closure_upvars ( def_id, substs) . unwrap ( ) ;
14471448 for upvar in upvars {
14481449 let var_id = upvar. def . def_id ( ) . local_id ( ) ;
14491450 type_must_outlive (
0 commit comments