Skip to content

Commit 40e3fb4

Browse files
author
Cameron Zwarich
committed
Use the MoveReason to determine a more precise MoveKind in gather_moves.
1 parent 5ccb764 commit 40e3fb4

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ pub fn gather_move_from_expr(bccx: &BorrowckCtxt,
4545
move_data: &MoveData,
4646
move_error_collector: &MoveErrorCollector,
4747
move_expr_id: ast::NodeId,
48-
cmt: mc::cmt) {
48+
cmt: mc::cmt,
49+
move_reason: euv::MoveReason) {
50+
let kind = match move_reason {
51+
euv::DirectRefMove | euv::PatBindingMove => MoveExpr,
52+
euv::CaptureMove => Captured
53+
};
4954
let move_info = GatherMoveInfo {
5055
id: move_expr_id,
51-
kind: MoveExpr,
56+
kind: kind,
5257
cmt: cmt,
5358
span_path_opt: None,
5459
};

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ impl<'a> euv::Delegate for GatherLoanCtxt<'a> {
7575
consume_id, cmt.repr(self.tcx()), mode);
7676

7777
match mode {
78-
euv::Copy => { return; }
79-
euv::Move(_) => { }
78+
euv::Move(move_reason) => {
79+
gather_moves::gather_move_from_expr(
80+
self.bccx, &self.move_data, &self.move_error_collector,
81+
consume_id, cmt, move_reason);
82+
}
83+
euv::Copy => { }
8084
}
81-
82-
gather_moves::gather_move_from_expr(
83-
self.bccx, &self.move_data, &self.move_error_collector,
84-
consume_id, cmt);
8585
}
8686

8787
fn consume_pat(&mut self,

0 commit comments

Comments
 (0)