Skip to content

Commit

Permalink
Don't emit landing pads with -Z no-landing-pads
Browse files Browse the repository at this point in the history
Closes #11647
  • Loading branch information
alexcrichton committed Jan 20, 2014
1 parent f3f2e69 commit caa321a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
32 changes: 32 additions & 0 deletions src/test/run-pass/no-landing-pads.rs
Original file line number Diff line number Diff line change
@@ -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 });
}

5 comments on commit caa321a

@bors
Copy link
Contributor

@bors bors commented on caa321a Jan 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from luqmana
at alexcrichton@caa321a

@bors
Copy link
Contributor

@bors bors commented on caa321a Jan 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/rust/issue-11647 = caa321a into auto

@bors
Copy link
Contributor

@bors bors commented on caa321a Jan 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/rust/issue-11647 = caa321a merged ok, testing candidate = 94236fc

@bors
Copy link
Contributor

@bors bors commented on caa321a Jan 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on caa321a Jan 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 94236fc

Please sign in to comment.