diff options
Diffstat (limited to 'tests/ui/borrowck/two-phase-baseline.rs')
-rw-r--r-- | tests/ui/borrowck/two-phase-baseline.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/borrowck/two-phase-baseline.rs b/tests/ui/borrowck/two-phase-baseline.rs new file mode 100644 index 000000000..994dc823d --- /dev/null +++ b/tests/ui/borrowck/two-phase-baseline.rs @@ -0,0 +1,9 @@ +// run-pass + +// This is the "goto example" for why we want two phase borrows. + +fn main() { + let mut v = vec![0, 1, 2]; + v.push(v.len()); + assert_eq!(v, [0, 1, 2, 3]); +} |