Skip to content

ICE: coverage: symbol_names: unexpected DefPathData: GlobalAsm #138261

Open
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Cinstrument-coverage
fn foo<const N: usize>() {}

core::arch::global_asm!("/* {} */", sym foo::<{
    || {};
    0
}>);

fn main() {}

original:

//@ build-pass
//@ needs-asm-support

fn foo<const N: usize>() {}

core::arch::global_asm!("/* {} */", sym foo::<{
    || {};
    0
}>);

fn main() {}

Version information

rustc 1.87.0-nightly (a96fa317d 2025-03-09)
binary: rustc
commit-hash: a96fa317d78c78a9de996afd317603c6970efc0d
commit-date: 2025-03-09
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Possibly related line of code:

DefPathData::CrateRoot
| DefPathData::Use
| DefPathData::GlobalAsm
| DefPathData::Impl
| DefPathData::MacroNs(_)
| DefPathData::LifetimeNs(_) => {
bug!("symbol_names: unexpected DefPathData: {:?}", disambiguated_data.data)
}
};
let name = disambiguated_data.data.get_opt_name();
self.path_append_ns(

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Cinstrument-coverage

Program output

warning: unused closure that must be used
 --> /tmp/icemaker_global_tempdir.iOtSTAvEbK4I/rustc_testrunner_tmpdir_reporting.cJF1HxUUm5mP/mvce.rs:4:5
  |
4 |     || {};
  |     ^^^^^
  |
  = note: closures are lazy and do nothing unless called
  = note: `#[warn(unused_must_use)]` on by default

error: internal compiler error: compiler/rustc_symbol_mangling/src/v0.rs:810:17: symbol_names: unexpected DefPathData: GlobalAsm


thread 'rustc' panicked at compiler/rustc_symbol_mangling/src/v0.rs:810:17:
Box<dyn Any>
stack backtrace:
   0:     0x78b7bebba414 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h52c7f0550840b8f9
   1:     0x78b7bf405bee - core::fmt::write::hee3b35a23fdf4ab3
   2:     0x78b7c0821e91 - std::io::Write::write_fmt::hf49dbaa0e19fcf6b
   3:     0x78b7bebba272 - std::sys::backtrace::BacktraceLock::print::hc7c25359d1b81c79
   4:     0x78b7bebbcb98 - std::panicking::default_hook::{{closure}}::h384e40742b2d89cc
   5:     0x78b7bebbc6b7 - std::panicking::default_hook::hdad5dc41d6be2842
   6:     0x78b7bdd0c93f - std[af3b6eacc99eae20]::panicking::update_hook::<alloc[63c0b52934c5697b]::boxed::Box<rustc_driver_impl[c2cc76304700d71f]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x78b7bebbd403 - std::panicking::rust_panic_with_hook::h45ecb165eb6636c0
   8:     0x78b7bdd49071 - std[af3b6eacc99eae20]::panicking::begin_panic::<rustc_errors[4dd87fb07da1f12a]::ExplicitBug>::{closure#0}
   9:     0x78b7bdd3d596 - std[af3b6eacc99eae20]::sys::backtrace::__rust_end_short_backtrace::<std[af3b6eacc99eae20]::panicking::begin_panic<rustc_errors[4dd87fb07da1f12a]::ExplicitBug>::{closure#0}, !>
  10:     0x78b7bdd3a12b - std[af3b6eacc99eae20]::panicking::begin_panic::<rustc_errors[4dd87fb07da1f12a]::ExplicitBug>
  11:     0x78b7bdd52bd1 - <rustc_errors[4dd87fb07da1f12a]::diagnostic::BugAbort as rustc_errors[4dd87fb07da1f12a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x78b7be3298da - rustc_middle[7aa79b75868ccd38]::util::bug::opt_span_bug_fmt::<rustc_span[6f95e09a31d512b0]::span_encoding::Span>::{closure#0}
  13:     0x78b7be31143a - rustc_middle[7aa79b75868ccd38]::ty::context::tls::with_opt::<rustc_middle[7aa79b75868ccd38]::util::bug::opt_span_bug_fmt<rustc_span[6f95e09a31d512b0]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x78b7be3112ab - rustc_middle[7aa79b75868ccd38]::ty::context::tls::with_context_opt::<rustc_middle[7aa79b75868ccd38]::ty::context::tls::with_opt<rustc_middle[7aa79b75868ccd38]::util::bug::opt_span_bug_fmt<rustc_span[6f95e09a31d512b0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x78b7bc5d86b0 - rustc_middle[7aa79b75868ccd38]::util::bug::bug_fmt
  16:     0x78b7be86b969 - <rustc_symbol_mangling[f0fc5090a3138737]::v0::SymbolMangler as rustc_middle[7aa79b75868ccd38]::ty::print::Printer>::print_def_path
  17:     0x78b7be86b824 - <rustc_symbol_mangling[f0fc5090a3138737]::v0::SymbolMangler as rustc_middle[7aa79b75868ccd38]::ty::print::Printer>::print_def_path
  18:     0x78b7be86b824 - <rustc_symbol_mangling[f0fc5090a3138737]::v0::SymbolMangler as rustc_middle[7aa79b75868ccd38]::ty::print::Printer>::print_def_path
  19:     0x78b7be86acac - rustc_symbol_mangling[f0fc5090a3138737]::v0::mangle
  20:     0x78b7bfb10dc4 - rustc_symbol_mangling[f0fc5090a3138737]::symbol_name_provider
  21:     0x78b7bfb0f8ea - rustc_query_impl[417e50fa6d8979be]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[417e50fa6d8979be]::query_impl::symbol_name::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7aa79b75868ccd38]::query::erase::Erased<[u8; 16usize]>>
  22:     0x78b7bfb0e8c1 - rustc_query_system[ed803ae4c980bdd6]::query::plumbing::try_execute_query::<rustc_query_impl[417e50fa6d8979be]::DynamicConfig<rustc_query_system[ed803ae4c980bdd6]::query::caches::DefaultCache<rustc_middle[7aa79b75868ccd38]::ty::instance::Instance, rustc_middle[7aa79b75868ccd38]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[417e50fa6d8979be]::plumbing::QueryCtxt, false>
  23:     0x78b7bfb0e51e - rustc_query_impl[417e50fa6d8979be]::query_impl::symbol_name::get_query_non_incr::__rust_end_short_backtrace
  24:     0x78b7c0289b86 - rustc_middle[7aa79b75868ccd38]::query::plumbing::query_get_at::<rustc_query_system[ed803ae4c980bdd6]::query::caches::DefaultCache<rustc_middle[7aa79b75868ccd38]::ty::instance::Instance, rustc_middle[7aa79b75868ccd38]::query::erase::Erased<[u8; 16usize]>>>
  25:     0x78b7bdb9102f - rustc_codegen_llvm[d40da1db6194ee81]::coverageinfo::mapgen::covfun::prepare_covfun_record
  26:     0x78b7c0302b76 - rustc_codegen_llvm[d40da1db6194ee81]::base::compile_codegen_unit::module_codegen
  27:     0x78b7c04882da - <rustc_codegen_llvm[d40da1db6194ee81]::LlvmCodegenBackend as rustc_codegen_ssa[f89046b61b918ef9]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  28:     0x78b7c0489b97 - <rustc_codegen_llvm[d40da1db6194ee81]::LlvmCodegenBackend as rustc_codegen_ssa[f89046b61b918ef9]::traits::backend::CodegenBackend>::codegen_crate
  29:     0x78b7c0549b23 - <rustc_interface[91d83e268fb48030]::queries::Linker>::codegen_and_build_linker
  30:     0x78b7c054752f - rustc_interface[91d83e268fb48030]::passes::create_and_enter_global_ctxt::<core[ed80027c49f06cd6]::option::Option<rustc_interface[91d83e268fb48030]::queries::Linker>, rustc_driver_impl[c2cc76304700d71f]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  31:     0x78b7c05374ee - rustc_interface[91d83e268fb48030]::interface::run_compiler::<(), rustc_driver_impl[c2cc76304700d71f]::run_compiler::{closure#0}>::{closure#1}
  32:     0x78b7c0371248 - std[af3b6eacc99eae20]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[91d83e268fb48030]::util::run_in_thread_with_globals<rustc_interface[91d83e268fb48030]::util::run_in_thread_pool_with_globals<rustc_interface[91d83e268fb48030]::interface::run_compiler<(), rustc_driver_impl[c2cc76304700d71f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  33:     0x78b7c0371b34 - <<std[af3b6eacc99eae20]::thread::Builder>::spawn_unchecked_<rustc_interface[91d83e268fb48030]::util::run_in_thread_with_globals<rustc_interface[91d83e268fb48030]::util::run_in_thread_pool_with_globals<rustc_interface[91d83e268fb48030]::interface::run_compiler<(), rustc_driver_impl[c2cc76304700d71f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ed80027c49f06cd6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x78b7c0372f2b - std::sys::pal::unix::thread::Thread::new::thread_start::h3e3ca1693a666c64
  35:     0x78b7ba4a370a - <unknown>
  36:     0x78b7ba527aac - <unknown>
  37:                0x0 - <unknown>

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: please make sure that you have updated to the latest nightly

note: rustc 1.87.0-nightly (a96fa317d 2025-03-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -C instrument-coverage -Z dump-mir-dir=dir

query stack during panic:
#0 [symbol_name] computing the symbol for `{global_asm#0}::{constant#0}::{closure#0}`
end of query stack
error: aborting due to 1 previous error; 1 warning emitted


Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions