about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-02 09:22:50 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-02 09:22:50 -0800
commit4dab96758aeb9ffaeedc7993cdabcf163f4fd491 (patch)
tree506751eef8f5fc887636cbe31f9f3972b47f32fe /src/test
parentb51ff9f06a3f6acdb8fb3641afedce69cde748ad (diff)
parent7a11b9aac48911e2de484a5c2115e6ba11238f8f (diff)
downloadrust-4dab96758aeb9ffaeedc7993cdabcf163f4fd491.tar.gz
rust-4dab96758aeb9ffaeedc7993cdabcf163f4fd491.zip
rollup merge of #20407: michaelwoerister/unreachable-locals
Fixes #20312
Diffstat (limited to 'src/test')
-rw-r--r--src/test/debuginfo/unreachable-locals.rs86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/test/debuginfo/unreachable-locals.rs b/src/test/debuginfo/unreachable-locals.rs
new file mode 100644
index 00000000000..c15dcd1958f
--- /dev/null
+++ b/src/test/debuginfo/unreachable-locals.rs
@@ -0,0 +1,86 @@
+// Copyright 2013-2014 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.
+
+// ignore-android: FIXME(#10381)
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+#![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
+
+// No need to actually run the debugger, just make sure that the compiler can
+// handle locals in unreachable code.
+
+fn after_return() {
+    return;
+    let x = "0";
+    let (ref y,z) = (1i32, 2u32);
+    match (20i32, 'c') {
+        (a, ref b) => {}
+    }
+    for a in [111i32].iter() {}
+}
+
+fn after_panic() {
+    panic!();
+    let x = "0";
+    let (ref y,z) = (1i32, 2u32);
+    match (20i32, 'c') {
+        (a, ref b) => {}
+    }
+    for a in [111i32].iter() {}
+}
+
+fn after_diverging_function() {
+    diverge();
+    let x = "0";
+    let (ref y,z) = (1i32, 2u32);
+    match (20i32, 'c') {
+        (a, ref b) => {}
+    }
+    for a in [111i32].iter() {}
+}
+
+fn after_break() {
+    loop {
+        break;
+        let x = "0";
+        let (ref y,z) = (1i32, 2u32);
+        match (20i32, 'c') {
+            (a, ref b) => {}
+        }
+        for a in [111i32].iter() {}
+    }
+}
+
+fn after_continue() {
+    for _ in range(0, 10i32) {
+        break;
+        let x = "0";
+        let (ref y,z) = (1i32, 2u32);
+        match (20i32, 'c') {
+            (a, ref b) => {}
+        }
+        for a in [111i32].iter() {}
+    }
+}
+
+fn main() {
+    after_return();
+    after_panic();
+    after_diverging_function();
+    after_break();
+    after_continue();
+}
+
+fn diverge() -> ! {
+    panic!();
+}