Skip to content

Internal compiler error when building docs for serde_with@3.14.1 on nightly #147882

@0xangelo

Description

@0xangelo

Hi. This is my first bug report so I appreciate any feedback on how to improve it.

Error occurs when building docs, using the nightly toolchain and the "-Zunstable-options --generate-link-to-definition" option, for crates that depend on serde_with at the version specified above. I've included a minimal example below. The compiler output explicitly suggested to file a bug report so I followed its link.

Code

Empty lib.rs

Cargo.toml:

[package]
edition = "2024"
name    = "serde-with-bug"
version = "0.0.0"

[dependencies]
serde_with = { version = "3.14.1" }

Meta

rustc --version verbose:

rustc 1.90.0 (1159e78c4 2025-09-14)

rustc +nightly --version --verbose:

rustc 1.92.0-nightly (844264add 2025-10-14)

Error output

Command:

RUSTDOCFLAGS="-Zunstable-options --generate-link-to-definition" cargo +nightly doc -p serde-with-bug
Output
thread 'rustc' panicked at compiler/rustc_middle/src/ty/typeck_results.rs:593:9:
Box<dyn Any>
stack backtrace:
   0:     0x7f70055a787b - std::backtrace::Backtrace::create::hdc5af62570bf684d
   1:     0x7f70055a77c5 - std::backtrace::Backtrace::force_capture::h6704da6a107157af
   2:     0x7f70045b95a2 - std[f2848e9921687d15]::panicking::update_hook::<alloc[8cb8d028b8bfe246]::boxed::Box<rustc_driver_impl[ccbd2d4287f01110]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7f70055a87cf - std::panicking::panic_with_hook::hf84d5e35d2f8db23
   4:     0x7f70045f2fb1 - std[f2848e9921687d15]::panicking::begin_panic::<rustc_errors[576678ed869e23f3]::ExplicitBug>::{closure#0}
   5:     0x7f70045e7286 - std[f2848e9921687d15]::sys::backtrace::__rust_end_short_backtrace::<std[f2848e9921687d15]::panicking::begin_panic<rustc_errors[576678ed869e23f3]::ExplicitBug>::{closure#0}, !>
   6:     0x7f70045e6814 - std[f2848e9921687d15]::panicking::begin_panic::<rustc_errors[576678ed869e23f3]::ExplicitBug>
   7:     0x7f70045fe591 - <rustc_errors[576678ed869e23f3]::diagnostic::BugAbort as rustc_errors[576678ed869e23f3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   8:     0x7f7004b96c8a - rustc_middle[fb0790242539ffc4]::util::bug::opt_span_bug_fmt::<rustc_span[61533d5b12f0c530]::span_encoding::Span>::{closure#0}
   9:     0x7f7004b96e4a - rustc_middle[fb0790242539ffc4]::ty::context::tls::with_opt::<rustc_middle[fb0790242539ffc4]::util::bug::opt_span_bug_fmt<rustc_span[61533d5b12f0c530]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  10:     0x7f7004b8591b - rustc_middle[fb0790242539ffc4]::ty::context::tls::with_context_opt::<rustc_middle[fb0790242539ffc4]::ty::context::tls::with_opt<rustc_middle[fb0790242539ffc4]::util::bug::opt_span_bug_fmt<rustc_span[61533d5b12f0c530]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  11:     0x7f70034586d0 - rustc_middle[fb0790242539ffc4]::util::bug::bug_fmt
  12:     0x7f7004b97e44 - rustc_middle[fb0790242539ffc4]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}
  13:     0x7f7004b96e16 - rustc_middle[fb0790242539ffc4]::ty::context::tls::with::<rustc_middle[fb0790242539ffc4]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}, !>::{closure#0}
  14:     0x7f7004b96e06 - rustc_middle[fb0790242539ffc4]::ty::context::tls::with_context::<rustc_middle[fb0790242539ffc4]::ty::context::tls::with<rustc_middle[fb0790242539ffc4]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}, !>::{closure#0}, !>::{closure#0}
  15:     0x7f7004b84813 - rustc_middle[fb0790242539ffc4]::ty::context::tls::with_context_opt::<rustc_middle[fb0790242539ffc4]::ty::context::tls::with_context<rustc_middle[fb0790242539ffc4]::ty::context::tls::with<rustc_middle[fb0790242539ffc4]::ty::typeck_results::invalid_hir_id_for_typeck_results::{closure#0}, !>::{closure#0}, !>::{closure#0}, !>
  16:     0x7f7004bc0ea4 - rustc_middle[fb0790242539ffc4]::ty::typeck_results::invalid_hir_id_for_typeck_results
  17:     0x7f70076d6aef - <rustc_middle[fb0790242539ffc4]::ty::typeck_results::TypeckResults>::qpath_res.cold
  18:     0x560cb2afa828 - <rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor as rustc_hir[47196bd28ebba74d]::intravisit::Visitor>::visit_qpath
  19:     0x560cb27a3423 - rustc_hir[47196bd28ebba74d]::intravisit::walk_where_predicate::<rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor>
  20:     0x560cb27ae0ac - rustc_hir[47196bd28ebba74d]::intravisit::walk_item::<rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor>
  21:     0x560cb2b9030f - <rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor as rustc_hir[47196bd28ebba74d]::intravisit::Visitor>::visit_block
  22:     0x560cb27ae1dd - rustc_hir[47196bd28ebba74d]::intravisit::walk_item::<rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor>
  23:     0x560cb2afa93b - <rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor as rustc_hir[47196bd28ebba74d]::intravisit::Visitor>::visit_mod
  24:     0x560cb2afa93b - <rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor as rustc_hir[47196bd28ebba74d]::intravisit::Visitor>::visit_mod
  25:     0x560cb2afa93b - <rustdoc[4af3b4be570136f6]::html::render::span_map::SpanMapVisitor as rustc_hir[47196bd28ebba74d]::intravisit::Visitor>::visit_mod
  26:     0x560cb2980d05 - <rustdoc[4af3b4be570136f6]::html::render::context::Context>::init
  27:     0x560cb2905781 - rustdoc[4af3b4be570136f6]::main_args::{closure#2}::{closure#0}
  28:     0x560cb28f9cae - rustc_interface[d8d0ae6a659ee2e1]::interface::run_compiler::<(), rustdoc[4af3b4be570136f6]::main_args::{closure#2}>::{closure#1}
  29:     0x560cb28451e8 - std[f2848e9921687d15]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d8d0ae6a659ee2e1]::util::run_in_thread_with_globals<rustc_interface[d8d0ae6a659ee2e1]::util::run_in_thread_pool_with_globals<rustc_interface[d8d0ae6a659ee2e1]::interface::run_compiler<(), rustdoc[4af3b4be570136f6]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  30:     0x560cb292b9bd - <<std[f2848e9921687d15]::thread::Builder>::spawn_unchecked_<rustc_interface[d8d0ae6a659ee2e1]::util::run_in_thread_with_globals<rustc_interface[d8d0ae6a659ee2e1]::util::run_in_thread_pool_with_globals<rustc_interface[d8d0ae6a659ee2e1]::interface::run_compiler<(), rustdoc[4af3b4be570136f6]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[8a8d4eba41ef67ed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f70069324ef - std::sys::thread::unix::Thread::new::thread_start::hb816fbd0968567ab
  32:     0x7f700069a97a - start_thread
  33:     0x7f7000722d2c - __GI___clone3
  34:                0x0 - <unknown>


rustc version: 1.92.0-nightly (844264add 2025-10-14)
platform: x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

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