Skip to content

Tweak ICE message #107771

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

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,11 +1200,9 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
if !info.payload().is::<rustc_errors::ExplicitBug>()
&& !info.payload().is::<rustc_errors::DelayedBugPanic>()
{
let mut d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic");
handler.emit_diagnostic(&mut d);
handler.emit_err(session_diagnostics::Ice);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
} else {
handler.emit_note(session_diagnostics::Ice);
}


handler.emit_note(session_diagnostics::Ice);
handler.emit_note(session_diagnostics::IceBugReport { bug_report_url });
handler.emit_note(session_diagnostics::IceVersion {
version: util::version_str!().unwrap_or("unknown_version"),
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/consts/const-eval/const-eval-query-stack.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// compile-flags: -Ztreat-err-as-bug=1
// failure-status: 101
// rustc-env:RUST_BACKTRACE=1
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
// normalize-stderr-test "\nerror: .*unexpectedly panicked.*\n\n" -> ""
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-eval/const-eval-query-stack.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
--> $DIR/const-eval-query-stack.rs:17:16
--> $DIR/const-eval-query-stack.rs:16:16
|
LL | const X: i32 = 1 / 0;
| ^^^^^ attempt to divide `1_i32` by zero
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/fmt/respanned-literal-issue-106191.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// known-bug: #106191
// unset-rustc-env:RUST_BACKTRACE
// had to be reverted
// error-pattern:internal compiler error
// error-pattern:unexpectedly panicked
// failure-status:101
// dont-check-compiler-stderr

Expand Down
4 changes: 1 addition & 3 deletions tests/ui/impl-trait/issues/issue-86800.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResu

stack backtrace:

error: internal compiler error: unexpected panic


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



Expand Down
2 changes: 1 addition & 1 deletion tests/ui/layout/valid_range_oob.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: internal compiler error: unexpected panic
error: the compiler unexpectedly panicked. this is a bug.

query stack during panic:
#0 [layout_of] computing layout of `Foo`
Expand Down
4 changes: 1 addition & 3 deletions tests/ui/panics/default-backtrace-ice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ LL | fn main() { missing_ident; }

stack backtrace:

error: internal compiler error: unexpected panic


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



Expand Down
2 changes: 1 addition & 1 deletion tests/ui/treat-err-as-bug/delay_span_bug.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: internal compiler error: delayed span bug triggered by #[rustc_error(dela
LL | fn main() {}
| ^^^^^^^^^

error: internal compiler error: unexpected panic
error: the compiler unexpectedly panicked. this is a bug.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, now that I think of it, @matthiaskrgr it should be equally valid to grep for something like "this is a bug" for delayed bug cases like this, rather than "unexpected panic". Is that ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rg'ed in my local cargo cache (3K crates, 81 git checkouts)

  • internal compiler error: 0
  • unexpected panic 14
  • this is a bug 109
  • the compiler unexpectedly panicked: 0

so "internal compiler error" and "the compiler unexpectedly panicked" gives us the most information because we can almost always be sure, that this is NOT a false positive from for example a format!("internal compiler error") that needed an extra & and sneaked into a diagnostic that way...
"this is a bug" however gives us the least amount of information because a bunch of other crates actually use this in their code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well "unexpectedly panicked" should also work as a good grep string then?


query stack during panic:
#0 [trigger_delay_span_bug] triggering a delay span bug
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/treat-err-as-bug/err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0080]: could not evaluate static initializer
LL | pub static C: u32 = 0 - 1;
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow

error: internal compiler error: unexpected panic
error: the compiler unexpectedly panicked. this is a bug.

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `C`
Expand Down