Skip to content

Debug assertion failure in hir/mod/map:956 #119593

Closed as not planned
Closed as not planned
@tmandry

Description

@tmandry

When building a single target in Fuchsia with debug assertions enabled, there are a bunch of repeated panic messages like this. All of them occur when type-checking the impl item outputted by a macro on this line of code. The failing assertion is this one in opt_span:

debug_assert_eq!(span.ctxt(), self.span_with_body(hir_id).ctxt());

thread 'rustc' panicked at compiler/rustc_middle/src/hir/map/mod.rs:956:9:
assertion `left == right` failed
  left: #104
 right: #105
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<rustc_span::hygiene::SyntaxContext, rustc_span::hygiene::SyntaxContext>
   4: <rustc_middle::hir::map::Map>::opt_span
   5: <rustc_middle::hir::map::Map>::span
   6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::supplied_sig_of_closure
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::sig_of_closure_no_expectation
   8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_closure
   9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_closure
  10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation
  13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation
  17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl_initializer
  18: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  19: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_stmt
  20: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  21: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  22: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation
  24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
  25: rustc_hir_typeck::check::check_fn
  26: rustc_hir_typeck::typeck
      [... omitted 2 frames ...]
  27: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}
  28: rustc_hir_analysis::check_crate
  29: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  30: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#0}::{closure#3}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  31: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
  32: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}::{closure#0}>
  33: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  34: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}>
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 attach the file at `/code/fuchsia/out/default/rustc-ice-2024-01-04T22_07_58-3292635.txt` to your bug report

note: compiler flags: --crate-type rlib -Z dep-info-omit-d-target -C linker=../../prebuilt/third_party/clang/linux-x64/bin/lld -C link-arg=--sysroot=gen/zircon/public/sysroot/cpp -C link-arg=-L../../prebuilt/third_party/clang/linux-x64/bin/../lib/x86_64-unknown-fuchsia/noexcept -C link-arg=-L../../prebuilt/third_party/clang/linux-x64/lib/clang/18/lib/x86_64-unknown-fuchsia -C link-arg=--pack-dyn-relocs=relr -C link-arg=-dynamic-linker=ld.so.1 -C link-arg=--icf=all -C link-arg=-zrel -Z remap-cwd-prefix=. -C force-frame-pointers -C opt-level=0 -C debuginfo=2 -C link-arg=--compress-debug-sections=zstd -C debug-assertions=yes -Z allow-features= -C prefer-dynamic -C link-args=-zstack-size=0x200000 -C panic=abort -C force-unwind-tables=yes -Z panic_abort_tests -C symbol-mangling-version=v0

query stack during panic:
#0 [typeck] type-checking `args::<impl at ../../src/performance/lib/fxt/rust/src/header.rs:60:9: 60:19>::new`
#1 [analysis] running analysis passes on this crate
end of query stack

rustc-ice-2024-01-04T22_07_58-3292635.txt

I do not have a minimized reproducer yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-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-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions