Medium
Holding a reference into a Vec across a push
What happens when this code is compiled?
main.rs
fn main() {
let mut v = vec![1, 2, 3];
let first = &v[0];
v.push(4);
println!("first: {}", first);
}2 of 53 in Rust
What happens when this code is compiled?
fn main() {
let mut v = vec![1, 2, 3];
let first = &v[0];
v.push(4);
println!("first: {}", first);
}