Skip to content

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

Closed
@RalfJung

Description

@RalfJung
Member

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

Activity

added
C-bugCategory: This is a bug.
requires-nightlyThis issue requires a nightly compiler in some way.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Aug 25, 2019
gnzlbg

gnzlbg commented on Aug 25, 2019

@gnzlbg
Contributor

That looks like a bug. cc @eddyb @alexcrichton

eddyb

eddyb commented on Aug 26, 2019

@eddyb
Member

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

RalfJung commented on Aug 26, 2019

@RalfJung
MemberAuthor

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

alexcrichton

alexcrichton commented on Aug 26, 2019

@alexcrichton
Member

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

added 2 commits that reference this issue on Oct 13, 2019

Rollup merge of rust-lang#65347 - RalfJung:unwind-abort-rust, r=varkor

24d57be

Rollup merge of rust-lang#65347 - RalfJung:unwind-abort-rust, r=varkor

d3cbf57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @alexcrichton@eddyb@RalfJung@gnzlbg@jonas-schievink

      Issue actions

        #[unwind(aborts)] does nothing on `extern "Rust" fn` · Issue #63883 · rust-lang/rust