这是indexloc提供的服务,不要输入任何密码
Skip to content

ICE with -Zself-profile-events=args #144457

@Kobzol

Description

@Kobzol

Nightly rustc currently ICEs with RUSTFLAGS="-Zself-profile -Zself-profile-events=args". cargo-bisect-rustc bisected this to #141753, and more specifically #141507 (CC @RalfJung).

Code

use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};

fn main() {
    AtomicUsize::new(0).load(Relaxed);
}

(minimized by cyrgani)

Error output

thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:716:17:
`trimmed_def_paths` called, diagnostics were expected but none were emitted. Use `with_no_trimmed_paths` for debugging.
Backtrace

thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:716:17:
`trimmed_def_paths` called, diagnostics were expected but none were emitted. Use `with_no_trimmed_paths` for debugging. This happened in the following `must_produce_diag` call's backtrace:
   0: <rustc_errors::DiagCtxtHandle>::set_must_produce_diag
   1: <rustc_session::session::Session>::record_trimmed_def_paths
   2: rustc_middle::ty::print::pretty::trimmed_def_paths
   3: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::trimmed_def_paths::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
   4: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
   5: rustc_query_impl::query_impl::trimmed_def_paths::get_query_incr::__rust_end_short_backtrace
   6: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_def_path
   7: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::pretty::PrettyPrinter>::pretty_print_const_valtree
   8: <rustc_middle::ty::consts::Const as core::fmt::Debug>::fmt
   9: <rustc_middle::ty::generic_args::GenericArg as core::fmt::Debug>::fmt
  10: core::fmt::builders::DebugList::entry
  11: <[rustc_middle::ty::generic_args::GenericArg] as core::fmt::Debug>::fmt
  12: core::fmt::builders::DebugTuple::field
  13: <(rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>) as core::fmt::Debug>::fmt
  14: core::fmt::builders::DebugStruct::field
  15: core::fmt::Formatter::debug_struct_field2_finish
  16: <&rustc_middle::ty::PseudoCanonicalInput<(rustc_span::def_id::DefId, &rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>)> as core::fmt::Debug>::fmt
  17: core::fmt::write
  18: alloc::fmt::format::format_inner
  19: rustc_query_impl::query_impl::resolve_instance_raw::alloc_self_profile_query_strings
  20: rustc_query_impl::profiling_support::alloc_self_profile_query_strings
  21: <rustc_middle::ty::context::TyCtxt>::finish
  22: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  23: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  24: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  25: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26: std::sys::pal::unix::thread::Thread::new::thread_start
  27: start_thread
             at ./nptl/pthread_create.c:447:8
  28: clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0

stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_errors::DiagCtxtInner as core::ops::drop::Drop>::drop
   3: core::ptr::drop_in_place::<rustc_errors::DiagCtxt>
   4: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
   5: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
   6: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: please attach the file at `/projects/personal/rust/rust/test-crate/hello/rustc-ice-2025-07-25T17_51_26-597963.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -Z self-profile -Z self-profile-events=args

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

query stack during panic:
end of query stack
error: could not compile `hello` (bin "hello")

Caused by:
  process didn't exit successfully: `/home/kobzol/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name hello --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=203 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=00515263bd9ed25e -C extra-filename=-2b29b38fb4b82a97 --out-dir /projects/personal/rust/rust/test-crate/hello/target/debug/deps -C incremental=/projects/personal/rust/rust/test-crate/hello/target/debug/incremental -L dependency=/projects/personal/rust/rust/test-crate/hello/target/debug/deps -Zself-profile -Zself-profile-events=args` (exit status: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    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