Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(nll)]
- fn main() {
- let mut vec = vec![1, 2, 3];
- // Borrow created here
- let x = &mut vec;
- x.push(4);
- // `x` isn't used after this point
- // so the borrow is dropped before `println!`
- // This wont compile with lexical lifetimes
- // because `x` lasts until end of scope
- println!("{:?}", vec);
- }
Add Comment
Please, Sign In to add comment