diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index ef40629946df0..4af9868026b03 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 0000000000000..3459f021f39bb --- /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 or the MIT license +// , 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 }); +}