Skip to content

Allow showing backtraces from proc-macro panics #75050

Closed
@Aaron1011

Description

@Aaron1011

Currently, rustc always hides the panic backtrace when a proc-macro panics:

// Hide the default panic output within `proc_macro` expansions.
// NB. the server can't do this because it may use a different libstd.
static HIDE_PANICS_DURING_EXPANSION: Once = Once::new();
HIDE_PANICS_DURING_EXPANSION.call_once(|| {
let prev = panic::take_hook();
panic::set_hook(Box::new(move |info| {
let hide = BridgeState::with(|state| match state {
BridgeState::NotConnected => false,
BridgeState::Connected(_) | BridgeState::InUse => true,
});
if !hide {
prev(info)
}
}));
});

It would be useful to able to set an environment variable or command-line argument to override this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-proc-macrosArea: Procedural macrosC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions