Change:
With beta but nightly does not show backtraces: edits this is with prioritize
can you share your example code, as it doesn't seem that all ICEs are missing backtraces: on the same nightly and beta, and which has a backtrace on both. (if you have the time to do so and a master checkout, it'd be interesting to know whether ThinLTO could be involved like in ; bisection would also be worthwhile)
Hmm interesting, maybe its' something that only happens with :thinking: does not show a backtrace for me ! I also can't force it with or anything :(
This backtrace was removed on purpose in because it's useless. It just points at the place in the error machinery where delayed bugs get flushed, which is either just noise or misleading at worse.
This also affects explicit calls too -- these should be restored in . Regarding s backtraces being useless, see .

Discussion:
}; // Invoke the default handler, which prints the actual panic message and optionally a backtrace <del> // Don't do this for `ExplicitBug`, which has an unhelpful message and backtrace. if !info.payload().is::<rustc_errors::ExplicitBug>() { </del> <ins> // Don't do this for `GoodPathBug`, which already emits its own more useful backtrace. if !info.payload().is::<rustc_errors::GoodPathBug>() { </ins> (*DEFAULT_HOOK)(info); // Separate the output with an empty line

// a .span_bug or .bug call has already printed what // it wants to print. <del> if !info.payload().is::<rustc_errors::ExplicitBug>() { </del> <ins> if !info.payload().is::<rustc_errors::ExplicitBug>() && !info.payload().is::<rustc_errors::GoodPathBug>() { </ins> let mut d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic"); handler.emit_diagnostic(&mut d); }

use rustc_span::HashStableContext; use rustc_span::{Loc, Span}; <ins> use std::any::Any; </ins> use std::borrow::Cow; <ins> use std::fmt; </ins> use std::hash::Hash; use std::num::NonZeroUsize; use std::panic; use std::path::Path; <del> use std::{error, fmt}; </del> use termcolor::{Color, ColorSpec};

/// Signifies that the compiler died with an explicit call to `.bug` /// or `.span_bug` rather than a failed assertion, etc. <del> #[derive(Copy, Clone, Debug)] </del> pub struct ExplicitBug; <del> impl fmt::Display for ExplicitBug { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "parser internal bug") } } impl error::Error for ExplicitBug {} </del> <ins> /// Signifies that the compiler died with an explicit call to `.delay_good_path_bug` /// rather than a failed assertion, etc. pub struct GoodPathBug; </ins> pub use diagnostic::{ AddToDiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgValue, DiagnosticId,

if !self.has_errors() { let bugs = std::mem::replace(&mut self.delayed_span_bugs, Vec::new()); <del> self.flush_delayed(bugs, "no errors encountered even though `delay_span_bug` issued"); </del> <ins> self.flush_delayed( bugs, "no errors encountered even though `delay_span_bug` issued", ExplicitBug, ); </ins> } // FIXME(eddyb) this explains what `delayed_good_path_bugs` are!

self.flush_delayed( bugs.into_iter().map(DelayedDiagnostic::decorate), "no warnings or errors encountered even though `delayed_good_path_bugs` issued", <ins> GoodPathBug, </ins> ); }

pub fn flush_delayed(&self) { let mut inner = self.inner.lock(); let bugs = std::mem::replace(&mut inner.delayed_span_bugs, Vec::new()); <del> inner.flush_delayed(bugs, "no errors encountered even though `delay_span_bug` issued"); </del> <ins> inner.flush_delayed( bugs, "no errors encountered even though `delay_span_bug` issued", ExplicitBug, ); </ins> } }

&mut self, bugs: impl IntoIterator<Item = Diagnostic>, explanation: impl Into<DiagnosticMessage> + Copy, <ins> panic_with: impl Any + Send + 'static, </ins> ) { let mut no_bugs = true; for mut bug in bugs {

// Panic with `ExplicitBug` to avoid "unexpected panic" messages. if !no_bugs { <del> panic::panic_any(ExplicitBug); </del> <ins> panic::panic_any(panic_with); </ins> } }