Skip to content

ICE on trying to debug format type #77458

@bjorn3

Description

@bjorn3

Code

Run format!("{:?}", ty) where ty is a rustc_middle::ty::Ty.

Meta

Happens since #73996. This makes rustc_codegen_cranelift ICE as it uses format!("{:?}", ty) to get the symbol name for vtables. Using -Ztrim-diagnostic-paths=no can be used as workaround.

rustc --version --verbose:

rustc 1.48.0-nightly (8fe73e80d 2020-10-01)
binary: rustc
commit-hash: 8fe73e80d762bc575040239fc05fb1c612873554
commit-date: 2020-10-01
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0

Error output

Backtrace

error: internal compiler error: trimmed_def_paths constructed
  |
  = note: delayed at    0: rustc_errors::Handler::delay_good_path_bug
             1: rustc_middle::ty::print::pretty::trimmed_def_paths
             2: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::trimmed_def_paths>::compute
             3: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             4: rustc_data_structures::stack::ensure_sufficient_stack
             5: rustc_query_system::query::plumbing::get_query_impl
             6: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_def_path
             7: rustc_middle::ty::print::pretty::PrettyPrinter::pretty_print_type
             8: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_type
             9: rustc_middle::ty::print::pretty::<impl core::fmt::Display for &rustc_middle::ty::TyS>::fmt
            10: core::fmt::write
            11: alloc::fmt::format
            12: rustc_codegen_cranelift::intrinsics::codegen_intrinsic_call
            13: rustc_codegen_cranelift::abi::codegen_terminator_call
            14: rustc_codegen_cranelift::base::codegen_fn_content
            15: rustc_session::utils::<impl rustc_session::session::Session>::time
            16: rustc_codegen_cranelift::base::trans_fn
            17: rustc_codegen_cranelift::driver::codegen_mono_items
            18: rustc_codegen_cranelift::driver::aot::module_codegen
            19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
            20: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
            21: rustc_session::utils::<impl rustc_session::session::Session>::time
            22: rustc_codegen_cranelift::driver::time
            23: rustc_codegen_cranelift::driver::aot::run_aot
            24: <rustc_codegen_cranelift::CraneliftCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
            25: rustc_session::utils::<impl rustc_session::session::Session>::time
            26: rustc_interface::passes::QueryContext::enter
            27: rustc_interface::queries::Queries::ongoing_codegen
            28: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
            29: rustc_span::with_source_map
            30: scoped_tls::ScopedKey<T>::set
            31: std::sys_common::backtrace::__rust_begin_short_backtrace
            32: core::ops::function::FnOnce::call_once{{vtable.shim}}
            33: std::sys::unix::thread::Thread::new::thread_start
            34: start_thread
            35: clone
          

thread 'rustc' panicked at 'no warnings or errors encountered even though `delayed_good_path_bugs` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0: rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: rustc_errors::HandlerInner::flush_delayed
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place
   5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
   6: core::ptr::drop_in_place
   7: rustc_span::with_source_map
   8: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z binary-dep-depinfo -Z force-unstable-if-unmarked -C embed-bitcode=no -C debuginfo=0 -C debug-assertions=off --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `cc`.

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/bjorn/Documenten/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "1" "--release" "--features" " max_level_info" "--manifest-path" "/home/bjorn/Documenten/rust/compiler/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /home/bjorn/Documenten/rust/build/bootstrap/debug/bootstrap build -j 1
Build completed unsuccessfully in 0:00:02

@rustbot modify labels: +requires-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustA-fmtArea: `core::fmt`C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions