1 // Test that a borrow which starts as a two-phase borrow and gets
2 // carried around a loop winds up conflicting with itself.
4 struct Foo { x: String }
7 fn get_string(&mut self) -> &str {
13 let mut foo = Foo { x: format!("Hello, world") };
14 let mut strings = vec![];
17 strings.push(foo.get_string()); //~ ERROR cannot borrow `foo` as mutable
18 if strings.len() > 2 { break; }
21 println!("{:?}", strings);