>>827
C++はそのようなデータ競合を見逃すけど
Rustはコンパイルエラーにしてくれる

let mut v = vec![0, 1, 2, 3, 4, 5, 6, 7];
let p5 = &v[5];
v.push(8);
assert!(*p5 == 5);

error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
| let p5 = &v[5];
|      - immutable borrow occurs here
| v.push(8);
| ^^^^^^^^^ mutable borrow occurs here
| assert!(*p5 == 5);
|     --- immutable borrow later used here