about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-09-10 22:34:56 +0200
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-09-13 23:28:10 +0200
commitefc7d46188c6696ae873b2b71ead7e34fc4501ab (patch)
treef6f45c59f62d441e32a51b2c8f7871adf6fb63df /src/test
parent539f2083de809b5c8304fe7426655cfeb0e66d5e (diff)
downloadrust-efc7d46188c6696ae873b2b71ead7e34fc4501ab.tar.gz
rust-efc7d46188c6696ae873b2b71ead7e34fc4501ab.zip
Analyse storage liveness and preserve it during generator transformation
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/generator/match-bindings.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/run-pass/generator/match-bindings.rs b/src/test/run-pass/generator/match-bindings.rs
new file mode 100644
index 00000000000..9c6b0571e58
--- /dev/null
+++ b/src/test/run-pass/generator/match-bindings.rs
@@ -0,0 +1,30 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(generators)]
+
+enum Enum {
+    A(String),
+    B
+}
+
+fn main() {
+    || {
+        loop {
+            if let true = true {
+                match Enum::A(String::new()) {
+                    Enum::A(_var) => {}
+                    Enum::B => {}
+                }
+            }
+            yield;
+        }
+    };
+}
\ No newline at end of file