Skip to content

ICE: Didn't find 'Class::Original' to close #148617

@dtolnay

Description

@dtolnay
// src/lib.rs

enum Enum {
    Variant,
}

pub fn repro() {
    if !matches!(Enum::Variant, Enum::Variant) {}
}

cargo rustdoc --lib --config='build.rustdocflags=["-Zunstable-options", "--generate-macro-expansion"]'

thread 'rustc' (2263394) panicked at src/librustdoc/html/highlight.rs:449:9:
Didn't find `Class::Original` to close
stack backtrace:
   0:     0x7bc6e245f223 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hde21067283f7e82e
   1:     0x7bc6e2c01afc - core::fmt::write::h24186904251c31cb
   2:     0x7bc6e2413d93 - std::io::Write::write_fmt::h3ab9f1f4d8d19b72
   3:     0x7bc6e24253a2 - std::sys::backtrace::BacktraceLock::print::he038489aba5894a6
   4:     0x7bc6e242b3f9 - std::panicking::default_hook::{{closure}}::h80a26d916c49679b
   5:     0x7bc6e242af23 - std::panicking::default_hook::he2e9efee79b3dce9
   6:     0x7bc6e1420c91 - std[e95ebcffb71a5621]::panicking::update_hook::<alloc[6ba2be5df7d20276]::boxed::Box<rustc_driver_impl[8bc3447375e6b2d8]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7bc6e242b81f - std::panicking::panic_with_hook::hf5648b7cec6bc73e
   8:     0x7bc6e242b5a6 - std::panicking::panic_handler::{{closure}}::h1b2ed3864ba94359
   9:     0x7bc6e24254e9 - std::sys::backtrace::__rust_end_short_backtrace::hd0186b2b27f5aaa7
  10:     0x7bc6e24060dd - __rustc[f7dae8b92efe1d7a]::rust_begin_unwind
  11:     0x7bc6df472000 - core::panicking::panic_fmt::hb5d6b83773432920
  12:     0x5acfe30cf3ba - rustdoc[f6dad7f1425a8a52]::html::highlight::end_expansion::<core[a4c7c2348b0f0abe]::fmt::Formatter>
  13:     0x5acfe31828dd - rustdoc[f6dad7f1425a8a52]::html::highlight::write_code::<core[a4c7c2348b0f0abe]::fmt::Formatter>::{closure#2}
  14:     0x5acfe3279907 - <rustdoc[f6dad7f1425a8a52]::html::highlight::Classifier>::advance
  15:     0x5acfe327a53b - <rustdoc[f6dad7f1425a8a52]::html::highlight::Classifier>::highlight
  16:     0x5acfe30ce825 - rustdoc[f6dad7f1425a8a52]::html::highlight::write_code::<core[a4c7c2348b0f0abe]::fmt::Formatter>
  17:     0x5acfe338b10b - <&core[a4c7c2348b0f0abe]::fmt::builders::FromFn<rustdoc[f6dad7f1425a8a52]::html::sources::print_src<&mut core[a4c7c2348b0f0abe]::fmt::Formatter>::{closure#0}> as core[a4c7c2348b0f0abe]::fmt::Display>::fmt
  18:     0x7bc6e2c01afc - core::fmt::write::h24186904251c31cb
  19:     0x5acfe338b7cb - <&askama[1cc127e36e4e4cf3]::filters::escape::Safe<&core[a4c7c2348b0f0abe]::fmt::builders::FromFn<rustdoc[f6dad7f1425a8a52]::html::sources::print_src<&mut core[a4c7c2348b0f0abe]::fmt::Formatter>::{closure#0}>> as core[a4c7c2348b0f0abe]::fmt::Display>::fmt
  20:     0x7bc6e2c01afc - core::fmt::write::h24186904251c31cb
  21:     0x5acfe3354195 - <rustdoc[f6dad7f1425a8a52]::html::sources::SourceCollector as rustdoc[f6dad7f1425a8a52]::visit::DocVisitor>::visit_item
  22:     0x5acfe3212fe8 - <rustdoc[f6dad7f1425a8a52]::html::render::context::Context>::init
  23:     0x5acfe3188938 - rustdoc[f6dad7f1425a8a52]::main_args::{closure#2}::{closure#0}
  24:     0x5acfe317d4ce - rustc_interface[d5ff205a9ab97820]::interface::run_compiler::<(), rustdoc[f6dad7f1425a8a52]::main_args::{closure#2}>::{closure#1}
  25:     0x5acfe30c5d08 - std[e95ebcffb71a5621]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d5ff205a9ab97820]::util::run_in_thread_with_globals<rustc_interface[d5ff205a9ab97820]::util::run_in_thread_pool_with_globals<rustc_interface[d5ff205a9ab97820]::interface::run_compiler<(), rustdoc[f6dad7f1425a8a52]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  26:     0x5acfe31aec8d - <<std[e95ebcffb71a5621]::thread::Builder>::spawn_unchecked_<rustc_interface[d5ff205a9ab97820]::util::run_in_thread_with_globals<rustc_interface[d5ff205a9ab97820]::util::run_in_thread_pool_with_globals<rustc_interface[d5ff205a9ab97820]::interface::run_compiler<(), rustdoc[f6dad7f1425a8a52]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[a4c7c2348b0f0abe]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x7bc6e3a95daf - std::sys::thread::unix::Thread::new::thread_start::hb3dc6483caa1b987
  28:     0x7bc6dd49caa4 - start_thread
                               at ./nptl/pthread_create.c:447:8
  29:     0x7bc6dd529c6c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
  30:                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-rustdoc&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/git/repro/rustc-ice-2025-11-07T03_41_46-2263393.txt` to your bug report

note: compiler flags: --crate-type lib -Z unstable-options

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

query stack during panic:
end of query stack

Bisects to #148573. Likely #148213 but I did not confirm for sure. @GuillaumeGomez @yotamofek

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-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions