]> git.lizzy.rs Git - rust.git/commitdiff
rollup merge of #17101 : pcwalton/for-loop-borrowck
authorAlex Crichton <alex@alexcrichton.com>
Tue, 9 Sep 2014 14:39:09 +0000 (07:39 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 9 Sep 2014 19:07:13 +0000 (12:07 -0700)
1  2 
src/librustc/middle/typeck/check/regionck.rs

index eb630d0fc7bbe083ba7e88e393f1e6395a4f28b1,951b42e5b80eb545910844505adfe6d652aa9359..c08401375ca7dc441f9b0c579c990eebd1275b3a
@@@ -196,8 -196,8 +196,8 @@@ macro_rules! ignore_err
      )
  )
  
 -pub struct Rcx<'a> {
 -    fcx: &'a FnCtxt<'a>,
 +pub struct Rcx<'a, 'tcx: 'a> {
 +    fcx: &'a FnCtxt<'a, 'tcx>,
  
      region_param_pairs: Vec<(ty::Region, ty::ParamTy)>,
  
@@@ -250,15 -250,15 +250,15 @@@ fn region_of_def(fcx: &FnCtxt, def: def
      }
  }
  
 -impl<'a> Rcx<'a> {
 -    pub fn new(fcx: &'a FnCtxt<'a>,
 -               initial_repeating_scope: ast::NodeId) -> Rcx<'a> {
 +impl<'a, 'tcx> Rcx<'a, 'tcx> {
 +    pub fn new(fcx: &'a FnCtxt<'a, 'tcx>,
 +               initial_repeating_scope: ast::NodeId) -> Rcx<'a, 'tcx> {
          Rcx { fcx: fcx,
                repeating_scope: initial_repeating_scope,
                region_param_pairs: Vec::new() }
      }
  
 -    pub fn tcx(&self) -> &'a ty::ctxt {
 +    pub fn tcx(&self) -> &'a ty::ctxt<'tcx> {
          self.fcx.ccx.tcx
      }
  
      }
  }
  
 -impl<'fcx> mc::Typer for Rcx<'fcx> {
 -    fn tcx<'a>(&'a self) -> &'a ty::ctxt {
 +impl<'fcx, 'tcx> mc::Typer<'tcx> for Rcx<'fcx, 'tcx> {
 +    fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> {
          self.fcx.ccx.tcx
      }
  
      }
  }
  
 -impl<'a> Visitor<()> for Rcx<'a> {
 +impl<'a, 'tcx> Visitor<()> for Rcx<'a, 'tcx> {
      // (..) FIXME(#3238) should use visit_pat, not visit_arm/visit_local,
      // However, right now we run into an issue whereby some free
      // regions are not properly related if they appear within the
@@@ -769,6 -769,10 +769,10 @@@ fn visit_expr(rcx: &mut Rcx, expr: &ast
              }
  
              rcx.visit_expr(&**head, ());
+             type_of_node_must_outlive(rcx,
+                                       infer::AddrOf(expr.span),
+                                       head.id,
+                                       ty::ReScope(expr.id));
  
              let repeating_scope = rcx.set_repeating_scope(body.id);
              rcx.visit_block(&**body, ());