Skip to content

Commit f63fad5

Browse files
author
Cameron Zwarich
committed
Add an Init mode to MutateMode.
This isn't necessary right now, but check_loans needs to be able to distinguish between initialization and writes in the ExprUseVisitor mutate callback.
1 parent 0339b27 commit f63fad5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/librustc/middle/borrowck/move_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl MoveData {
356356
let path_index = self.move_path(tcx, lp.clone());
357357

358358
match mode {
359-
euv::JustWrite => {
359+
euv::Init | euv::JustWrite => {
360360
self.assignee_ids.borrow_mut().insert(assignee_id);
361361
}
362362
euv::WriteAndRead => { }

src/librustc/middle/expr_use_visitor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub enum ConsumeMode {
8686

8787
#[deriving(PartialEq,Show)]
8888
pub enum MutateMode {
89+
Init,
8990
JustWrite, // x = y
9091
WriteAndRead, // x += y
9192
}
@@ -712,7 +713,7 @@ impl<'d,'t,TYPER:mc::Typer> ExprUseVisitor<'d,'t,TYPER> {
712713
let def = def_map.borrow().get_copy(&pat.id);
713714
match mc.cat_def(pat.id, pat.span, pat_ty, def) {
714715
Ok(binding_cmt) => {
715-
delegate.mutate(pat.id, pat.span, binding_cmt, JustWrite);
716+
delegate.mutate(pat.id, pat.span, binding_cmt, Init);
716717
}
717718
Err(_) => { }
718719
}

0 commit comments

Comments
 (0)