Skip to content

rustc crash when proc macro panics if compiled with -Cpanic=abort #82320

Closed
@ojeda

Description

@ojeda

Code

Panicking proc macro p.rs:

extern crate proc_macro;

#[proc_macro]
pub fn p(_: proc_macro::TokenStream) -> proc_macro::TokenStream {
    panic!()
}

User m.rs:

extern crate p;
p::p! {}

Then:

$ rustc -Cpanic=abort --crate-type proc-macro p.rs
$ rustc -L. m.rs

Meta

Reproduces in 1.49.0, 1.50.0 as well as nightlies.

Error output

Depends on how the proc macro is compiled. It can range from some output:

$ rustc -Cpanic=abort --crate-type proc-macro p.rs
$ rustc -L. m.rs
fatal runtime error: failed to initiate panic, error 5
(aborted)

To nothing at all:

$ rustc -Cpanic=abort --crate-type proc-macro p.rs -Cforce-unwind-tables=y
$ rustc -L. m.rs
(return code 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-proc-macrosArea: Procedural macrosC-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions