Skip to content

Commit

Permalink
auto merge of #6784 : nikomatsakis/rust/moves-into-borrowck, r=pcwalton
Browse files Browse the repository at this point in the history
Move the computation of what data is moved out of `liveness` and into `borrowck`. The resulting code is cleaner, since before we had a split distribution of responsibilities, and also this avoids having multiple implementations of the dataflow code. Liveness is still used to report warnings about useless writes. This will go away when we get the control-flow graph code landed (working on that).

Also adds borrow checker documentation.

Fixes #4384.
Required to support once fns and to properly fix closures (#2202).
First step to generalize our treatment of moves somewhat as well.
  • Loading branch information
bors committed May 29, 2013
2 parents e946b4f + f30b538 commit d80642b
Show file tree
Hide file tree
Showing 48 changed files with 2,203 additions and 1,363 deletions.
12 changes: 6 additions & 6 deletions src/librust/rust.rc
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
}

match args {
[command_string] => print_usage(command_string),
_ => Invalid
[ref command_string] => print_usage(copy *command_string),
_ => Invalid
}
}

fn cmd_test(args: &[~str]) -> ValidUsage {
match args {
[filename] => {
let test_exec = Path(filename).filestem().unwrap() + "test~";
[ref filename] => {
let test_exec = Path(*filename).filestem().unwrap() + "test~";
invoke("rustc", &[~"--test", filename.to_owned(),
~"-o", test_exec.to_owned()], rustc::main);
let exit_code = run::process_status(~"./" + test_exec, []);
Expand All @@ -172,8 +172,8 @@ fn cmd_test(args: &[~str]) -> ValidUsage {

fn cmd_run(args: &[~str]) -> ValidUsage {
match args {
[filename, ..prog_args] => {
let exec = Path(filename).filestem().unwrap() + "~";
[ref filename, ..prog_args] => {
let exec = Path(*filename).filestem().unwrap() + "~";
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
rustc::main);
let exit_code = run::process_status(~"./"+exec, prog_args);
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ pub fn compile_rest(sess: Session,
time(time_passes, ~"loop checking", ||
middle::check_loop::check_crate(ty_cx, crate));

let middle::moves::MoveMaps {moves_map, variable_moves_map,
moved_variables_set, capture_map} =
let middle::moves::MoveMaps {moves_map, moved_variables_set,
capture_map} =
time(time_passes, ~"compute moves", ||
middle::moves::compute_moves(ty_cx, method_map, crate));

Expand All @@ -274,7 +274,6 @@ pub fn compile_rest(sess: Session,

time(time_passes, ~"liveness checking", ||
middle::liveness::check_crate(ty_cx, method_map,
variable_moves_map,
capture_map, crate));

let (root_map, write_guard_map) =
Expand Down
Loading

0 comments on commit d80642b

Please sign in to comment.