( "v[1]: {}", v[ 1 ]); } fn consume(v: Vec < i32 >) { /* `v` *dropped* at scope end */ } foo(r1) attempts an indirect read of v1 error: cannot move out of `v1` because it is borrowed consume(v1); ^~ note: borrow of `v1` occurs here let r1 = &v1; ^~ Lifetimes and Lexical Scope fn borrow_checking_may_seem_simple_minded() { let v1 = vec!
[ 4, 5, 6 ]; // | + let r2 = { // | | let r1 = &v1; // + | | // ~~~ <--- A // | | | foo(r1); // 'r1 | | &v2 // | 'v1 'v2 }; // + + | | // (maybe mutate `v1` // | | | // here someday?)