Skip to content

ICE when documenting embedded-io with nightly: node HirId(...) cannot be placed in TypeckResults #149089

@robamu

Description

@robamu

I receive an ICE trying to build the nightly docs for the embedded-io library.

Reproduction Steps

git clone https://github.com/rust-embedded/embedded-hal.git
cd embedded-hal/embedded-io
RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc

Expected Outcome

Docs build.

Actual Output

RUSTDOCFLAGS="--cfg docsrs --generate-link-to-definition -Z unstable-options" cargo +nightly doc
 Documenting embedded-io v0.7.1 (/home/muellerr/Rust/embedded-hal/embedded-io)

error: internal compiler error: compiler/rustc_middle/src/ty/typeck_results.rs:585:9: node HirId(DefId(0:124 ~ embedded_io[88f1]::Write::write_fmt::Adapter).18) (type `T::Error`) cannot be placed in TypeckResults with hir_owner DefId(0:123 ~ embedded_io[88f1]::Write::write_fmt)


thread 'rustc' (62703) panicked at compiler/rustc_middle/src/ty/typeck_results.rs:585:9:
Box<dyn Any>
stack backtrace:
   0:     0x72ad58525123 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfb8348192fc43ebb
   1:     0x72ad58c01a9c - core::fmt::write::h97437f5687cea27d
   2:     0x72ad584da6b6 - std::io::Write::write_fmt::h3d69a328c4d5e4d7
   3:     0x72ad584f192c - std::panicking::default_hook::{{closure}}::h6aede591faff46a7
   4:     0x72ad584f1483 - std::panicking::default_hook::h7b4ecf50b930d151
   5:     0x72ad57534907 - std[3c083641319d47af]::panicking::update_hook::<alloc[b775178a7c8507ec]::boxed::Box<rustc_driver_impl[e2b35ac28e24aea2]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x72ad584f1ce2 - std::panicking::panic_with_hook::hdbcd646c750dedf5
   7:     0x72ad5756efb1 - std[3c083641319d47af]::panicking::begin_panic::<rustc_errors[f99eb3eef40c1bf3]::ExplicitBug>::{closure#0}
   8:     0x72ad57561676 - std[3c083641319d47af]::sys::backtrace::__rust_end_short_backtrace::<std[3c083641319d47af]::panicking::begin_panic<rustc_errors[f99eb3eef40c1bf3]::ExplicitBug>::{closure#0}, !>
   9:     0x72ad5756147f - std[3c083641319d47af]::panicking::begin_panic::<rustc_errors[f99eb3eef40c1bf3]::ExplicitBug>
  10:     0x72ad5758c671 - <rustc_errors[f99eb3eef40c1bf3]::diagnostic::BugAbort as rustc_errors[f99eb3eef40c1bf3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x72ad57b03889 - rustc_middle[92ef52462bc1851d]::util::bug::opt_span_bug_fmt::<rustc_span[cdbd5621f0a550f6]::span_encoding::Span>::{closure#0}
  12:     0x72ad57b03b52 - rustc_middle[92ef52462bc1851d]::ty::context::tls::with_opt::<rustc_middle[92ef52462bc1851d]::util::bug::opt_span_bug_fmt<rustc_span[cdbd5621f0a550f6]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x72ad57af406b - rustc_middle[92ef52462bc1851d]::ty::context::tls::with_context_opt::<rustc_middle[92ef52462bc1851d]::ty::context::tls::with_opt<rustc_middle[92ef52462bc1851d]::util::bug::opt_span_bug_fmt<rustc_span[cdbd5621f0a550f6]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x72ad55e1e8a4 - rustc_middle[92ef52462bc1851d]::util::bug::bug_fmt
  15:     0x72ad57b04983 - rustc_middle[92ef52462bc1851d]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}
  16:     0x72ad57b039f6 - rustc_middle[92ef52462bc1851d]::ty::context::tls::with::<rustc_middle[92ef52462bc1851d]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}, !>::{closure#0}
  17:     0x72ad57b039e6 - rustc_middle[92ef52462bc1851d]::ty::context::tls::with_context::<rustc_middle[92ef52462bc1851d]::ty::context::tls::with<rustc_middle[92ef52462bc1851d]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}, !>::{closure#0}, !>::{closure#0}
  18:     0x72ad57af3093 - rustc_middle[92ef52462bc1851d]::ty::context::tls::with_context_opt::<rustc_middle[92ef52462bc1851d]::ty::context::tls::with_context<rustc_middle[92ef52462bc1851d]::ty::context::tls::with<rustc_middle[92ef52462bc1851d]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}, !>::{closure#0}, !>::{closure#0}, !>
  19:     0x72ad57b2bef4 - rustc_middle[92ef52462bc1851d]::ty::typeck_results::invalid_hir_id_for_typeck_results
  20:     0x72ad5a905cd3 - <rustc_middle[92ef52462bc1851d]::ty::typeck_results::TypeckResults>::qpath_res.cold
  21:     0x5851095174c6 - <rustdoc[e4479888891ef69]::html::render::span_map::SpanMapVisitor as rustc_hir[b7c24ccb62dd1aaf]::intravisit::Visitor>::visit_qpath
  22:     0x58510951708d - <rustdoc[e4479888891ef69]::html::render::span_map::SpanMapVisitor as rustc_hir[b7c24ccb62dd1aaf]::intravisit::Visitor>::visit_qpath
  23:     0x585109243add - rustc_hir[b7c24ccb62dd1aaf]::intravisit::walk_item::<rustdoc[e4479888891ef69]::html::render::span_map::SpanMapVisitor>
  24:     0x5851095bbd6f - <rustdoc[e4479888891ef69]::html::render::span_map::SpanMapVisitor as rustc_hir[b7c24ccb62dd1aaf]::intravisit::Visitor>::visit_block
  25:     0x585109244818 - rustc_hir[b7c24ccb62dd1aaf]::intravisit::walk_item::<rustdoc[e4479888891ef69]::html::render::span_map::SpanMapVisitor>
  26:     0x5851095175eb - <rustdoc[e4479888891ef69]::html::render::span_map::SpanMapVisitor as rustc_hir[b7c24ccb62dd1aaf]::intravisit::Visitor>::visit_mod
  27:     0x5851093bb001 - <rustdoc[e4479888891ef69]::html::render::context::Context>::init
  28:     0x58510932c99c - rustdoc[e4479888891ef69]::main_args::{closure#2}::{closure#0}
  29:     0x585109322bbb - rustc_interface[f4dc2643b08c82c2]::interface::run_compiler::<(), rustdoc[e4479888891ef69]::main_args::{closure#2}>::{closure#1}
  30:     0x585109264dc8 - std[3c083641319d47af]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f4dc2643b08c82c2]::util::run_in_thread_with_globals<rustc_interface[f4dc2643b08c82c2]::util::run_in_thread_pool_with_globals<rustc_interface[f4dc2643b08c82c2]::interface::run_compiler<(), rustdoc[e4479888891ef69]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  31:     0x58510935185d - <<std[3c083641319d47af]::thread::Builder>::spawn_unchecked_<rustc_interface[f4dc2643b08c82c2]::util::run_in_thread_with_globals<rustc_interface[f4dc2643b08c82c2]::util::run_in_thread_pool_with_globals<rustc_interface[f4dc2643b08c82c2]::interface::run_compiler<(), rustdoc[e4479888891ef69]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[161168e1bae70b66]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x72ad59cfec2f - std::sys::thread::unix::Thread::new::thread_start::he2d9ab7043ddc2b3
  33:     0x72ad5369caa4 - start_thread
                               at ./nptl/pthread_create.c:447:8
  34:     0x72ad53729c6c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
  35:                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-rustdoc&template=ice.md

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

note: please attach the file at `/home/muellerr/Rust/embedded-hal/rustc-ice-2025-11-19T10_10_08-62702.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
warning: `embedded-io` (lib doc) generated 6 warnings
error: could not document `embedded-io`

Version

❯ rustdoc +nightly --version
rustdoc 1.93.0-nightly (3d461af 2025-11-18)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-link-to-definitionrustdoc --generate-link-to-definition nightly-only featureC-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-rustdocRelevant to the rustdoc 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