Skip to content

[ICE]: cargo doc panicked #152601

@ozongzi

Description

@ozongzi

note: when I run cargo doc on my machine, it works. However, when I upload my crate to crate.io, Its doc build failed. My complier says error: the compiler unexpectedly panicked. This is a bug. So I report it here.

Code

ds-api crate
(I want to create a minimal verifiable example here, but when I try to extract some code, the problem doesn't reappear. Additionally, it's a library where moving some of the documentation out causes dependency issues.)

Meta

rustc --version --verbose:

<version>
rustc 1.95.0-nightly (7057231bd 2026-02-11)
binary: rustc
commit-hash: 7057231bd78d6c7893f905ea1832365d4c5efe17
commit-date: 2026-02-11
host: aarch64-apple-darwin
release: 1.95.0-nightly
LLVM version: 22.1.0

Error output && backtrace

<output>
thread 'rustc' panicked at /rustc-dev/7057231bd78d6c7893f905ea1832365d4c5efe17/compiler/rustc_span/src/lib.rs:2427:17:
assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32
rustc version: 1.95.0-nightly (7057231bd 2026-02-11)
platform: aarch64-apple-darwin

query stack during panic:
end of query stack
Backtrace

<backtrace>

stack backtrace:
   0:        0x1122a1acc - <std[7788ac8975d8e8dd]::backtrace::Backtrace>::create
   1:        0x1101b0bd8 - std[7788ac8975d8e8dd]::panicking::update_hook::<alloc[cb3a57bddbbb3a0e]::boxed::Box<rustc_driver_impl[b13e88dc34847181]::install_ice_hook::{closure#1}>>::{closure#0}
   2:        0x1122b3030 - std[7788ac8975d8e8dd]::panicking::panic_with_hook
   3:        0x112296ff4 - std[7788ac8975d8e8dd]::panicking::panic_handler::{closure#0}
   4:        0x11228b9d4 - std[7788ac8975d8e8dd]::sys::backtrace::__rust_end_short_backtrace::<std[7788ac8975d8e8dd]::panicking::panic_handler::{closure#0}, !>
   5:        0x112298598 - __rustc[7b32525fab805468]::rust_begin_unwind
   6:        0x1152cdf10 - core[c63dc24221d9bb9]::panicking::panic_fmt
   7:        0x1152cdee8 - core[c63dc24221d9bb9]::panicking::panic
   8:        0x111c55fec - <rustc_span[a2a644c568dacf4f]::SourceFile>::lookup_file_pos_with_col_display
   9:        0x111c597d8 - <rustc_span[a2a644c568dacf4f]::source_map::SourceMap>::lookup_char_pos
  10:        0x1025e46d4 - <rustdoc[88d450d44240f3ab]::clean::types::Span>::cnum
  11:        0x10257f950 - <rustdoc[88d450d44240f3ab]::html::render::context::Context>::href_from_span
  12:        0x1026b23ec - <&core[c63dc24221d9bb9]::fmt::builders::FromFn<rustdoc[88d450d44240f3ab]::html::sources::print_src<&mut core[c63dc24221d9bb9]::fmt::Formatter>::{closure#0}> as core[c63dc24221d9bb9]::fmt::Display>::fmt
  13:        0x10f55e9a4 - core[c63dc24221d9bb9]::fmt::write
  14:        0x1026b280c - <&askama[41a6cfd8763841f7]::filters::escape::Safe<&core[c63dc24221d9bb9]::fmt::builders::FromFn<rustdoc[88d450d44240f3ab]::html::sources::print_src<&mut core[c63dc24221d9bb9]::fmt::Formatter>::{closure#0}>> as core[c63dc24221d9bb9]::fmt::Display>::fmt
  15:        0x10f55e9a4 - core[c63dc24221d9bb9]::fmt::write
  16:        0x102516288 - rustdoc[88d450d44240f3ab]::html::render::render_call_locations::<&mut core[c63dc24221d9bb9]::fmt::Formatter>::{closure#2}
  17:        0x1026e0cb4 - <core[c63dc24221d9bb9]::fmt::builders::FromFn<rustdoc[88d450d44240f3ab]::html::render::document_full_inner::{closure#0}> as core[c63dc24221d9bb9]::fmt::Display>::fmt
  18:        0x1023e68d4 - rustdoc[88d450d44240f3ab]::html::render::render_impl::{closure#0}::doc_impl_item::<&mut alloc[cb3a57bddbbb3a0e]::string::String, &mut alloc[cb3a57bddbbb3a0e]::string::String>
  19:        0x1026dee10 - <core[c63dc24221d9bb9]::fmt::builders::FromFn<rustdoc[88d450d44240f3ab]::html::render::render_impl::{closure#0}> as core[c63dc24221d9bb9]::fmt::Display>::fmt
  20:        0x1026190a4 - rustdoc[88d450d44240f3ab]::html::render::render_assoc_items_inner
  21:        0x1026e06e4 - <core[c63dc24221d9bb9]::fmt::builders::FromFn<rustdoc[88d450d44240f3ab]::html::render::render_assoc_items::{closure#0}> as core[c63dc24221d9bb9]::fmt::Display>::fmt
  22:        0x10f55e9a4 - core[c63dc24221d9bb9]::fmt::write
  23:        0x1023ce6c4 - <rustdoc[88d450d44240f3ab]::html::render::print_item::DisplayStruct>::render_into::<core[c63dc24221d9bb9]::fmt::Formatter>
  24:        0x1026e443c - <core[c63dc24221d9bb9]::fmt::builders::FromFn<rustdoc[88d450d44240f3ab]::html::render::print_item::item_struct::{closure#0}> as core[c63dc24221d9bb9]::fmt::Display>::fmt
  25:        0x10f55e9a4 - core[c63dc24221d9bb9]::fmt::write
  26:        0x1024775a4 - rustdoc[88d450d44240f3ab]::html::layout::render::<core[c63dc24221d9bb9]::fmt::builders::FromFn<rustdoc[88d450d44240f3ab]::html::render::print_item::print_item::{closure#0}>, core[c63dc24221d9bb9]::fmt::builders::FromFn<<rustdoc[88d450d44240f3ab]::html::render::context::Context>::render_item::{closure#1}>>
  27:        0x10257f148 - <rustdoc[88d450d44240f3ab]::html::render::context::Context>::render_item
  28:        0x1026c9d10 - <rustdoc[88d450d44240f3ab]::html::render::context::Context as rustdoc[88d450d44240f3ab]::formats::renderer::FormatRenderer>::item
  29:        0x10247e3b8 - rustdoc[88d450d44240f3ab]::formats::renderer::run_format_inner::<rustdoc[88d450d44240f3ab]::html::render::context::Context>
  30:        0x10247e580 - rustdoc[88d450d44240f3ab]::formats::renderer::run_format_inner::<rustdoc[88d450d44240f3ab]::html::render::context::Context>
  31:        0x10247e580 - rustdoc[88d450d44240f3ab]::formats::renderer::run_format_inner::<rustdoc[88d450d44240f3ab]::html::render::context::Context>
  32:        0x10247e580 - rustdoc[88d450d44240f3ab]::formats::renderer::run_format_inner::<rustdoc[88d450d44240f3ab]::html::render::context::Context>
  33:        0x10247e580 - rustdoc[88d450d44240f3ab]::formats::renderer::run_format_inner::<rustdoc[88d450d44240f3ab]::html::render::context::Context>
  34:        0x10251cc94 - rustdoc[88d450d44240f3ab]::main_args::{closure#2}::{closure#0}
  35:        0x102510558 - rustc_interface[3ac416560c55d6f4]::interface::run_compiler::<(), rustdoc[88d450d44240f3ab]::main_args::{closure#2}>::{closure#1}
  36:        0x102475e9c - std[7788ac8975d8e8dd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3ac416560c55d6f4]::util::run_in_thread_with_globals<rustc_interface[3ac416560c55d6f4]::util::run_in_thread_pool_with_globals<rustc_interface[3ac416560c55d6f4]::interface::run_compiler<(), rustdoc[88d450d44240f3ab]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  37:        0x10253b700 - <std[7788ac8975d8e8dd]::thread::lifecycle::spawn_unchecked<rustc_interface[3ac416560c55d6f4]::util::run_in_thread_with_globals<rustc_interface[3ac416560c55d6f4]::util::run_in_thread_pool_with_globals<rustc_interface[3ac416560c55d6f4]::interface::run_compiler<(), rustdoc[88d450d44240f3ab]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c63dc24221d9bb9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:        0x1122bdd68 - <std[7788ac8975d8e8dd]::sys::thread::unix::Thread>::new::thread_start
  39:        0x197779c08 - __pthread_cond_wait

Metadata

Metadata

Labels

A-rustdoc-scrape-examplesArea: The (unstable) rustdoc scrape-examples feature described in RFC 3123C-bugCategory: This is a bug.D-Unicode-unawareDiagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-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