Skip to content

ICE: hir: explicit panic #142649

Open
Open
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn main() {
    #[deprecated = "oh no"]
    #[cfg]
    0
}

original:

fn main() {
    #[deprecated = "oh no"]#[cfg]0
}

Version information

rustc 1.89.0-nightly (f3db63916 2025-06-17)
binary: rustc
commit-hash: f3db63916e541ff039ac3cd7364c2d612749b61b
commit-date: 2025-06-17
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.7

Possibly related line of code:

#[inline]
fn style(&self) -> AttrStyle {
match &self {
Attribute::Unparsed(u) => u.style,
Attribute::Parsed(AttributeKind::DocComment { style, .. }) => *style,
_ => panic!(),
}
}
}
// FIXME(fn_delegation): use function delegation instead of manually forwarding
impl Attribute {

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: `cfg` is not followed by parentheses
 --> /tmp/icemaker_global_tempdir.TKUrz1r4Ivcl/rustc_testrunner_tmpdir_reporting.zI5VU3Z1dC85/mvce.rs:3:5
  |
3 |     #[cfg]
  |     ^^^^^^ help: expected syntax is: `cfg(/* predicate */)`

warning: attribute is ignored here
 --> /tmp/icemaker_global_tempdir.TKUrz1r4Ivcl/rustc_testrunner_tmpdir_reporting.zI5VU3Z1dC85/mvce.rs:2:5
  |
2 |     #[deprecated = "oh no"]
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_attributes)]` on by default


thread 'rustc' panicked at compiler/rustc_hir/src/hir.rs:1353:18:
explicit panic
stack backtrace:
   0:     0x71cd8eaff733 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf6b8e560b2aaddbb
   1:     0x71cd8f202cb7 - core::fmt::write::h512536cc11a37f1b
   2:     0x71cd8eaf5263 - std::io::Write::write_fmt::h187d52edf76d8022
   3:     0x71cd8eaff592 - std::sys::backtrace::BacktraceLock::print::h35718979b39d7a33
   4:     0x71cd8eb0317a - std::panicking::default_hook::{{closure}}::hc9d1a33dc3084210
   5:     0x71cd8eb02cff - std::panicking::default_hook::hd6f81cf0b769b874
   6:     0x71cd8dbfbfd3 - std[9333bc5333c76994]::panicking::update_hook::<alloc[b28f35111b9cd925]::boxed::Box<rustc_driver_impl[9c8bc2fa3092ec28]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x71cd8eb039e3 - std::panicking::rust_panic_with_hook::hfaae9da84f44c762
   8:     0x71cd8eb036da - std::panicking::begin_panic_handler::{{closure}}::h388c7963d93cd2b7
   9:     0x71cd8eaffc09 - std::sys::backtrace::__rust_end_short_backtrace::h47ca3b58dfe8fab9
  10:     0x71cd8eb033ad - __rustc[871f36a778bdfc9]::rust_begin_unwind
  11:     0x71cd8b295b00 - core::panicking::panic_fmt::h82d75da6f9ebf9a2
  12:     0x71cd8d5e5686 - core::panicking::panic_explicit::hd3af6f8734692b01
  13:     0x71cd8c6c5197 - <rustc_hir[b1a3cee99d54fa36]::hir::Attribute as rustc_ast[528e74ef4f3ffeec]::attr::AttributeExt>::style::panic_cold_explicit
  14:     0x71cd8dcbf9f3 - <rustc_hir[b1a3cee99d54fa36]::hir::Expr>::precedence::{closure#0}::{closure#0}
  15:     0x71cd911944cd - <rustc_hir_typeck[8542d075aaf85410]::fn_ctxt::FnCtxt>::precedence::{closure#0}.llvm.3780047115223620710.cold
  16:     0x71cd8fefa582 - <rustc_hir[b1a3cee99d54fa36]::hir::Expr>::precedence
  17:     0x71cd8df03f43 - <rustc_hir_typeck[8542d075aaf85410]::fn_ctxt::FnCtxt>::suggest_deref_ref_or_into
  18:     0x71cd8debff43 - <rustc_hir_typeck[8542d075aaf85410]::fn_ctxt::FnCtxt>::emit_type_mismatch_suggestions
  19:     0x71cd8dec54ae - <rustc_hir_typeck[8542d075aaf85410]::fn_ctxt::FnCtxt>::emit_coerce_suggestions
  20:     0x71cd8fb50daa - <rustc_hir_typeck[8542d075aaf85410]::fn_ctxt::FnCtxt>::check_expr_block
  21:     0x71cd8fbb24e7 - <rustc_hir_typeck[8542d075aaf85410]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22:     0x71cd8fb58334 - rustc_hir_typeck[8542d075aaf85410]::check::check_fn
  23:     0x71cd903ec414 - rustc_hir_typeck[8542d075aaf85410]::typeck_with_inspect::{closure#0}
  24:     0x71cd903d8a30 - rustc_query_impl[335bf943c842fa2e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[335bf943c842fa2e]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[85dd1ff96372fcb9]::query::erase::Erased<[u8; 8usize]>>
  25:     0x71cd8f440fee - rustc_query_system[f4098d1cf50ce8b4]::query::plumbing::try_execute_query::<rustc_query_impl[335bf943c842fa2e]::DynamicConfig<rustc_data_structures[f506b16921f7bc93]::vec_cache::VecCache<rustc_span[8686395707142f0d]::def_id::LocalDefId, rustc_middle[85dd1ff96372fcb9]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[f4098d1cf50ce8b4]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[335bf943c842fa2e]::plumbing::QueryCtxt, false>
  26:     0x71cd8f440a49 - rustc_query_impl[335bf943c842fa2e]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  27:     0x71cd8f449074 - rustc_hir_analysis[b968f598936cb41b]::check_crate
  28:     0x71cd8faadae5 - rustc_interface[f2bb11eed659e555]::passes::analysis
  29:     0x71cd8faad709 - rustc_query_impl[335bf943c842fa2e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[335bf943c842fa2e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[85dd1ff96372fcb9]::query::erase::Erased<[u8; 0usize]>>
  30:     0x71cd9026674e - rustc_query_system[f4098d1cf50ce8b4]::query::plumbing::try_execute_query::<rustc_query_impl[335bf943c842fa2e]::DynamicConfig<rustc_query_system[f4098d1cf50ce8b4]::query::caches::SingleCache<rustc_middle[85dd1ff96372fcb9]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[335bf943c842fa2e]::plumbing::QueryCtxt, false>
  31:     0x71cd90266336 - rustc_query_impl[335bf943c842fa2e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  32:     0x71cd90472d9c - rustc_interface[f2bb11eed659e555]::passes::create_and_enter_global_ctxt::<core[b2a367d0a99567d4]::option::Option<rustc_interface[f2bb11eed659e555]::queries::Linker>, rustc_driver_impl[9c8bc2fa3092ec28]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  33:     0x71cd90464149 - rustc_interface[f2bb11eed659e555]::interface::run_compiler::<(), rustc_driver_impl[9c8bc2fa3092ec28]::run_compiler::{closure#0}>::{closure#1}
  34:     0x71cd904174b2 - std[9333bc5333c76994]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f2bb11eed659e555]::util::run_in_thread_with_globals<rustc_interface[f2bb11eed659e555]::util::run_in_thread_pool_with_globals<rustc_interface[f2bb11eed659e555]::interface::run_compiler<(), rustc_driver_impl[9c8bc2fa3092ec28]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  35:     0x71cd90417196 - <<std[9333bc5333c76994]::thread::Builder>::spawn_unchecked_<rustc_interface[f2bb11eed659e555]::util::run_in_thread_with_globals<rustc_interface[f2bb11eed659e555]::util::run_in_thread_pool_with_globals<rustc_interface[f2bb11eed659e555]::interface::run_compiler<(), rustc_driver_impl[9c8bc2fa3092ec28]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b2a367d0a99567d4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x71cd904157bd - std::sys::pal::unix::thread::Thread::new::thread_start::hd9016145e0d739a0
  37:     0x71cd89ea57eb - <unknown>
  38:     0x71cd89f2918c - <unknown>
  39:                0x0 - <unknown>

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: rustc 1.89.0-nightly (f3db63916 2025-06-17) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error; 1 warning emitted


Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions