1 // cmpile-flags: -Z borrowck=mir
3 // This is the first counter-example from Niko's blog post
4 // smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
5 // of a danger for code to crash if we just turned off the check for whether
6 // a mutable-borrow aliases another borrow.
9 let mut v: Vec<String> = vec![format!("Hello, ")];
12 v.push(format!("foo"));
13 //~^ ERROR cannot borrow `v` as mutable more than once at a time [E0499]