diff options
| author | Cameron Zwarich <zwarich@mozilla.com> | 2014-06-06 11:59:32 -0700 |
|---|---|---|
| committer | Cameron Zwarich <zwarich@mozilla.com> | 2014-06-06 11:59:32 -0700 |
| commit | f63fad5d60f451013a6787fec4db12b77cab018c (patch) | |
| tree | bdf6401b3c0c93784a3a8cccb8fc3657e873b4d2 /src | |
| parent | 0339b27e6db07e50bf71edc5eb78133a418a5949 (diff) | |
| download | rust-f63fad5d60f451013a6787fec4db12b77cab018c.tar.gz rust-f63fad5d60f451013a6787fec4db12b77cab018c.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/middle/borrowck/move_data.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/expr_use_visitor.rs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index 5a4ec36befc..1c72c6d6702 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -356,7 +356,7 @@ impl MoveData { let path_index = self.move_path(tcx, lp.clone()); match mode { - euv::JustWrite => { + euv::Init | euv::JustWrite => { self.assignee_ids.borrow_mut().insert(assignee_id); } euv::WriteAndRead => { } diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 467cd726a65..f806fcb1f7e 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -86,6 +86,7 @@ pub enum ConsumeMode { #[deriving(PartialEq,Show)] pub enum MutateMode { + Init, JustWrite, // x = y WriteAndRead, // x += y } @@ -712,7 +713,7 @@ impl<'d,'t,TYPER:mc::Typer> ExprUseVisitor<'d,'t,TYPER> { let def = def_map.borrow().get_copy(&pat.id); match mc.cat_def(pat.id, pat.span, pat_ty, def) { Ok(binding_cmt) => { - delegate.mutate(pat.id, pat.span, binding_cmt, JustWrite); + delegate.mutate(pat.id, pat.span, binding_cmt, Init); } Err(_) => { } } |
