summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/two-phase-control-flow-split-before-activation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/two-phase-control-flow-split-before-activation.rs')
-rw-r--r--tests/ui/borrowck/two-phase-control-flow-split-before-activation.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/borrowck/two-phase-control-flow-split-before-activation.rs b/tests/ui/borrowck/two-phase-control-flow-split-before-activation.rs
new file mode 100644
index 000000000..0b20e1945
--- /dev/null
+++ b/tests/ui/borrowck/two-phase-control-flow-split-before-activation.rs
@@ -0,0 +1,15 @@
+// run-pass
+
+fn main() {
+ let mut a = 0;
+ let mut b = 0;
+ let p = if maybe() {
+ &mut a
+ } else {
+ &mut b
+ };
+ use_(p);
+}
+
+fn maybe() -> bool { false }
+fn use_<T>(_: T) { }