]> git.lizzy.rs Git - rust.git/commitdiff
Merge branch 'master' into backtrace
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Sat, 5 Jan 2019 12:11:29 +0000 (13:11 +0100)
committerGitHub <noreply@github.com>
Sat, 5 Jan 2019 12:11:29 +0000 (13:11 +0100)
tests/run-pass/2phase.rs

index 5b9e5d3ea5ff716ca4fd45af9bd4e05f7592ba86..987adca477a6fce79b300f97c6757c17b764eef0 100644 (file)
@@ -16,6 +16,18 @@ fn two_phase2() {
     v.push(v.len());
 }
 
+fn two_phase3(b: bool) {
+    let mut x = &mut vec![];
+    let mut y = vec![];
+    x.push((
+        {
+            if b { x = &mut y };
+            22
+        },
+        x.len(),
+    ));
+}
+
 /*
 fn two_phase_overlapping1() {
     let mut x = vec![];
@@ -62,6 +74,8 @@ impl<T> Thing for Cell<T> {}
 fn main() {
     two_phase1();
     two_phase2();
+    two_phase3(false);
+    two_phase3(true);
     match_two_phase();
     with_interior_mutability();
     //FIXME: enable these, or remove them, depending on how https://github.com/rust-lang/rust/issues/56254 gets resolved