diff options
| author | Cameron Zwarich <zwarich@mozilla.com> | 2014-06-06 11:59:33 -0700 |
|---|---|---|
| committer | Cameron Zwarich <zwarich@mozilla.com> | 2014-06-06 11:59:33 -0700 |
| commit | 40e3fb4c0b46569b0ab4f5642ed1726915d59e98 (patch) | |
| tree | 71798cd21a29dac4b17e38f9f6f9f0d67459a766 | |
| parent | 5ccb7644be0f0ab04a76bf88c93cecb63b1ba20d (diff) | |
| download | rust-40e3fb4c0b46569b0ab4f5642ed1726915d59e98.tar.gz rust-40e3fb4c0b46569b0ab4f5642ed1726915d59e98.zip | |
Use the MoveReason to determine a more precise MoveKind in gather_moves.
| -rw-r--r-- | src/librustc/middle/borrowck/gather_loans/gather_moves.rs | 9 | ||||
| -rw-r--r-- | src/librustc/middle/borrowck/gather_loans/mod.rs | 12 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs index 16fd03c1aad..6df47480977 100644 --- a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs @@ -45,10 +45,15 @@ pub fn gather_move_from_expr(bccx: &BorrowckCtxt, move_data: &MoveData, move_error_collector: &MoveErrorCollector, move_expr_id: ast::NodeId, - cmt: mc::cmt) { + cmt: mc::cmt, + move_reason: euv::MoveReason) { + let kind = match move_reason { + euv::DirectRefMove | euv::PatBindingMove => MoveExpr, + euv::CaptureMove => Captured + }; let move_info = GatherMoveInfo { id: move_expr_id, - kind: MoveExpr, + kind: kind, cmt: cmt, span_path_opt: None, }; diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs index 5192ddc793b..003687e7b63 100644 --- a/src/librustc/middle/borrowck/gather_loans/mod.rs +++ b/src/librustc/middle/borrowck/gather_loans/mod.rs @@ -75,13 +75,13 @@ impl<'a> euv::Delegate for GatherLoanCtxt<'a> { consume_id, cmt.repr(self.tcx()), mode); match mode { - euv::Copy => { return; } - euv::Move(_) => { } + euv::Move(move_reason) => { + gather_moves::gather_move_from_expr( + self.bccx, &self.move_data, &self.move_error_collector, + consume_id, cmt, move_reason); + } + euv::Copy => { } } - - gather_moves::gather_move_from_expr( - self.bccx, &self.move_data, &self.move_error_collector, - consume_id, cmt); } fn consume_pat(&mut self, |
