diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-07-15 01:22:13 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-07-28 15:46:25 +0200 |
| commit | 10def9a6e0fc9ace09934f71a8eef0b556e9111f (patch) | |
| tree | b23a6da8f5efea0b2d4179ba690dcd9ce941420a | |
| parent | 2ad0f89e867df98b4be3573d58f99d3abcaf02e1 (diff) | |
| download | rust-10def9a6e0fc9ace09934f71a8eef0b556e9111f.tar.gz rust-10def9a6e0fc9ace09934f71a8eef0b556e9111f.zip | |
Revert borrowck changes
| -rw-r--r-- | src/librustc_borrowck/borrowck/gather_loans/mod.rs | 29 | ||||
| -rw-r--r-- | src/librustc_borrowck/diagnostics.rs | 1 |
2 files changed, 4 insertions, 26 deletions
diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index bcfc9db56fc..426eef59570 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -21,7 +21,6 @@ use borrowck::move_data::MoveData; use rustc::middle::expr_use_visitor as euv; use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; -use rustc::middle::region::extent_has_yield; use rustc::middle::region; use rustc::ty::{self, TyCtxt}; @@ -37,20 +36,19 @@ mod gather_moves; mod move_error; pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - body_id: hir::BodyId) + body: hir::BodyId) -> (Vec<Loan<'tcx>>, move_data::MoveData<'tcx>) { - let def_id = bccx.tcx.hir.body_owner_def_id(body_id); + let def_id = bccx.tcx.hir.body_owner_def_id(body); let param_env = bccx.tcx.param_env(def_id); - let body = bccx.tcx.hir.body(body_id); let mut glcx = GatherLoanCtxt { bccx: bccx, all_loans: Vec::new(), - item_ub: region::CodeExtent::Misc(body_id.node_id), + item_ub: region::CodeExtent::Misc(body.node_id), move_data: MoveData::new(), move_error_collector: move_error::MoveErrorCollector::new(), - generator: body.is_generator(), }; + let body = glcx.bccx.tcx.hir.body(body); euv::ExprUseVisitor::new(&mut glcx, bccx.tcx, param_env, &bccx.region_maps, bccx.tables) .consume_body(body); @@ -67,7 +65,6 @@ struct GatherLoanCtxt<'a, 'tcx: 'a> { /// `item_ub` is used as an upper-bound on the lifetime whenever we /// ask for the scope of an expression categorized as an upvar. item_ub: region::CodeExtent, - generator: bool, } impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { @@ -219,19 +216,6 @@ fn check_aliasability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, } } -fn check_yields<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - borrow_span: Span, - loan_region: ty::Region<'tcx>) { - if let &ty::RegionKind::ReScope(extent) = loan_region { - if extent_has_yield(bccx.tcx, extent) { - span_err!(bccx.tcx.sess, - borrow_span, - E0624, - "cannot borrow this value across the suspend point of a generator"); - } - } -} - /// Implements the M-* rules in README.md. fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, borrow_span: Span, @@ -343,11 +327,6 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { return; } - // Check that the region has no yields if this is in a generator - if self.generator { - check_yields(self.bccx, borrow_span, loan_region); - } - // Check that the lifetime of the borrow does not exceed // the lifetime of the data being borrowed. if lifetime::guarantee_lifetime(self.bccx, self.item_ub, diff --git a/src/librustc_borrowck/diagnostics.rs b/src/librustc_borrowck/diagnostics.rs index 2ae9498d63c..cc9bdf8c8a5 100644 --- a/src/librustc_borrowck/diagnostics.rs +++ b/src/librustc_borrowck/diagnostics.rs @@ -1192,5 +1192,4 @@ register_diagnostics! { E0595, // closure cannot assign to {} E0598, // lifetime of {} is too short to guarantee its contents can be... E0623, // borrow of the implicit argument of a generator - E0624, // borrow across a suspend point } |
