diff options
Diffstat (limited to 'src/test/ui/borrowck/two-phase-across-loop.rs')
-rw-r--r-- | src/test/ui/borrowck/two-phase-across-loop.rs | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/test/ui/borrowck/two-phase-across-loop.rs b/src/test/ui/borrowck/two-phase-across-loop.rs deleted file mode 100644 index 3fcea7d17..000000000 --- a/src/test/ui/borrowck/two-phase-across-loop.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Test that a borrow which starts as a two-phase borrow and gets -// carried around a loop winds up conflicting with itself. - -struct Foo { x: String } - -impl Foo { - fn get_string(&mut self) -> &str { - &self.x - } -} - -fn main() { - let mut foo = Foo { x: format!("Hello, world") }; - let mut strings = vec![]; - - loop { - strings.push(foo.get_string()); //~ ERROR cannot borrow `foo` as mutable - if strings.len() > 2 { break; } - } - - println!("{:?}", strings); -} |