What makes Rust successful?
What is going on here?
From the documentation of push_back
: “[…] all iterators (including the end() iterator) and all references to the elements are invalidated”
fn main() {
let mut v = vec![1, 2, 3, 4];
let p = &v[0];
1 v.push(41);
println!("{}", p);
}
v
as mutable because it is also borrowed as immutable
Introduction to the Rust type system