Skip to content

ICEs should always print the top of the query stack. #70953

Closed
@eddyb

Description

@eddyb

E.g. for #70942, instead of:

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

We could print something more like

error: internal compiler error: unexpected panic
    while const-evaluating `main::{{constant}}#0`
    ... (full query stack hidden, use `RUST_BACKTRACE=1` to enable)

note: the compiler unexpectedly panicked. this is a bug.

(not super sure about the RUST_BACKTRACE=1 suggestion message)

This (and the query stack more generally) should allow quicker diagnosis, and there should be no cost to just having this on by default for ICEs.

It could also be useful to users, as they could use it to figure out roughly where in their code they're triggering the ICE (similar to the Span from a span_bug!), to work around the ICE in the meanwhile or know which error to fix (in case it's a side-effect of an error) to get rid of the ICE.

cc @rust-lang/compiler @rust-lang/wg-diagnostics

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions