about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-01-18 11:21:10 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-01-20 13:29:49 -0800
commitcaa321ab7d2b5d82e87c7d88dcb5ab7bd2adfd66 (patch)
tree4e8295d848f0978a5a8f39b57360ef1aba39adef /src
parentf3f2e697d8d21190bb99e86bae2de39f012162aa (diff)
downloadrust-caa321ab7d2b5d82e87c7d88dcb5ab7bd2adfd66.tar.gz
rust-caa321ab7d2b5d82e87c7d88dcb5ab7bd2adfd66.zip
Don't emit landing pads with -Z no-landing-pads
Closes #11647
Diffstat (limited to 'src')
-rw-r--r--src/librustc/middle/trans/base.rs2
-rw-r--r--src/test/run-pass/no-landing-pads.rs32
2 files changed, 33 insertions, 1 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index ef40629946d..4af9868026b 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -940,7 +940,7 @@ pub fn invoke<'a>(
         }
     }
 
-    if bcx.fcx.needs_invoke() {
+    if need_invoke(bcx) {
         unsafe {
             debug!("invoking {} at {}", llfn, bcx.llbb);
             for &llarg in llargs.iter() {
diff --git a/src/test/run-pass/no-landing-pads.rs b/src/test/run-pass/no-landing-pads.rs
new file mode 100644
index 00000000000..3459f021f39
--- /dev/null
+++ b/src/test/run-pass/no-landing-pads.rs
@@ -0,0 +1,32 @@
+// Copyright 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.
+
+// compile-flags: -Z no-landing-pads
+// xfail-fast
+
+use std::task;
+
+static mut HIT: bool = false;
+
+struct A;
+
+impl Drop for A {
+    fn drop(&mut self) {
+        unsafe { HIT = true; }
+    }
+}
+
+fn main() {
+    do task::try::<()> {
+        let _a = A;
+        fail!();
+    };
+    assert!(unsafe { !HIT });
+}