Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[unwind(aborts)] does nothing on extern "Rust" fn #63883

Closed
RalfJung opened this issue Aug 25, 2019 · 4 comments · Fixed by #65347
Closed

#[unwind(aborts)] does nothing on extern "Rust" fn #63883

RalfJung opened this issue Aug 25, 2019 · 4 comments · Fixed by #65347
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented Aug 25, 2019

I would expect the following code to abort, and never print Hello:

#![feature(unwind_attributes)]

#[unwind(aborts)]
fn foo() { // implicitly: extern "Rust"
    panic!("foooo");
}

fn main() {
    if let Err(_) = std::panic::catch_unwind(|| foo()) {}
    println!("Hello");
}

But instead, the unwind attribute is ignored.

Cc @gnzlbg

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 25, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 25, 2019

That looks like a bug. cc @eddyb @alexcrichton

@eddyb
Copy link
Member

eddyb commented Aug 26, 2019

extern "Rust" fn is just fn, and having extern "Rust" in the testcase may create the wrong impression (i.e. this bug has nothing to do with FFI).

Still, the attribute should either work and cause an abort or error as unapplicable.

@RalfJung
Copy link
Member Author

I deliberately made it explicit, but sure, I can adjust the example.

@alexcrichton
Copy link
Member

Agreed that this just looks like a bug that needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants