( "v[1]: {}", v[ 1 ]); } fn consume(v: Vec < i32 >) { } error: cannot move out of `v1` because it is borrowed consume(v1); ^~ note: borrow of `v1` occurs here let r1 = &v1; ^~ (artifact of lexical-scope based implementation) Built on lexical scopes, but non-trivial #[ test ] fn copying_can_extend_a_borrows_lifetime_1() { fn foo< 'a >(v: & 'a Vec < i32 >) { println!
[ 4, 5, 6 ]; // | + let r2 = { // | | let r1 = &v1; // + | | // ~~~ <--- A // | | | foo(r1); // 'r1 | | &v2 // | 'v1 'v2 }; // + + | | // (maybe mutate `v1` // | | | // here someday?)