Skip to content

Instantly share code, notes, and snippets.

@brson
Created September 19, 2012 04:11
Show Gist options
  • Save brson/3747648 to your computer and use it in GitHub Desktop.
Save brson/3747648 to your computer and use it in GitHub Desktop.
let mut c = configure(o);
let home = c.root;
let first_time = os::path_exists(&home.push("sources.json"));
if !first_time && o.free[1] != ~"init" {
cmd_init(&c);
// FIXME (#2662): shouldn't need to reconfigure
c = configure(o);
}
let c = &c;
/home/brian/dev/rust/src/cargo/cargo.rs:1929:8: 1929:9 error: assigning to mutable local variable prohibited due to outstanding loan
/home/brian/dev/rust/src/cargo/cargo.rs:1929 c = configure(o);
^
/home/brian/dev/rust/src/cargo/cargo.rs:1932:13: 1932:14 note: loan of mutable local variable granted here
/home/brian/dev/rust/src/cargo/cargo.rs:1932 let c = &c;
Oh, but this works:
let mut c = configure(o);
let home = c.root;
let first_time = os::path_exists(&home.push("sources.json"));
if !first_time && o.free[1] != ~"init" {
cmd_init(&c);
// FIXME (#2662): shouldn't need to reconfigure
c = configure(o);
}
let d = move c;
let c = &d;
And this works!
let mut c = configure(o);
let home = c.root;
let first_time = os::path_exists(&home.push("sources.json"));
if !first_time && o.free[1] != ~"init" {
cmd_init(&c);
// FIXME (#2662): shouldn't need to reconfigure
c = configure(o);
}
let c = &move c;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment