Skip to content

ICE during stage2 lib rustdoc invocation when remapping build path prefix #140778

Closed as duplicate of#138520
@winterqt

Description

@winterqt

Code

n/a

Meta

rustc --version --verbose:

1.86.0

Error output

Note: the below "compiler flags" listing is missing the --remap-path-prefix flag, set via the RUSTFLAGS environment variable: in this example, --remap-path-prefix /private/tmp/nix-build-rustc-1.86.0.drv-0=/build

Documenting stage2 library {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} in HTML format (aarch64-apple-darwin)
   Compiling shlex v1.3.0
    Checking core v0.0.0 (/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/library/core)
   Compiling libc v0.2.169
   Compiling object v0.36.7
   Compiling std v0.0.0 (/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/library/std)
 Documenting core v0.0.0 (/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/library/core)
   Compiling cc v1.2.0
   Compiling compiler_builtins v0.1.146
    Checking rustc-std-workspace-core v1.99.0 (/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/library/rustc-std-workspace-core)
    Checking alloc v0.0.0 (/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/library/alloc)
    Checking cfg-if v1.0.0
    Checking adler2 v2.0.0
    Checking memchr v2.7.4
    Checking rustc-demangle v0.1.24
 Documenting alloc v0.0.0 (/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/library/alloc)
    Checking unwind v0.0.0 (/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/library/unwind)

thread 'rustc' panicked at compiler/rustc_span/src/source_map.rs:1170:34:
internal error: entered unreachable code: attempted to remap an already remapped filename
stack backtrace:
   0:        0x10d5886d0 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hca7aa0b57853f228
   1:        0x10d5dc47c - core::fmt::write::hb1835f7c0114bc02
   2:        0x10d5829c0 - std::io::Write::write_fmt::h6232d52279512823
   3:        0x10d588584 - std::sys::backtrace::BacktraceLock::print::h9282efd295678fbc
   4:        0x10d559e58 - std::panicking::default_hook::{{closure}}::hc8002e1fc2bf3922
   5:        0x10d559d6c - std::panicking::default_hook::h9b7b895146a0bb6f
   6:        0x10ace8584 - <alloc[dd56cb0eced0a665]::boxed::Box<rustc_driver_impl[da71dea85671d1b3]::install_ice_hook::{closure#1}> as core[7da8311a60047a04]::ops::function::Fn<(&dyn for<'a, 'b> core[7da8311a60047a04]::ops::function::Fn<(&'a std[46c86b5ae2734bc0]::panic::PanicHookInfo<'b>,), Output = ()> + core[7da8311a60047a04]::marker::Sync + core[7da8311a60047a04]::marker::Send, &std[46c86b5ae2734bc0]::panic::PanicHookInfo)>>::call
   7:        0x10d55a558 - std::panicking::rust_panic_with_hook::h44751474a749be6a
   8:        0x10d589528 - std::panicking::begin_panic_handler::{{closure}}::hc862cf59c01b6777
   9:        0x10d588934 - std::sys::backtrace::__rust_end_short_backtrace::hf9fcd8d30f9db2fa
  10:        0x10d559ef4 - _rust_begin_unwind
  11:        0x10d75b4a0 - core::panicking::panic_fmt::h7c60468cf75205f7
  12:        0x10d4d54a4 - <rustc_span[2e39c00920be160e]::source_map::FilePathMapping>::map_filename_prefix
  13:        0x10d4cbd74 - <rustc_span[2e39c00920be160e]::source_map::SourceMap>::new_source_file
  14:        0x10ce78988 - rustc_parse[52226b5fc1a124f6]::new_parser_from_source_str
  15:        0x1047a5260 - rustdoc[ed7ad655a9d9df10]::clean::render_macro_matchers::render_macro_matcher
  16:        0x1049e36b0 - rustdoc[ed7ad655a9d9df10]::clean::utils::render_macro_arms::<core[7da8311a60047a04]::iter::adapters::map::Map<core[7da8311a60047a04]::slice::iter::Chunks<rustc_ast[dfe5dc25c4e2414f]::tokenstream::TokenTree>, rustdoc[ed7ad655a9d9df10]::clean::utils::display_macro_source::{closure#0}>>
  17:        0x1049e384c - rustdoc[ed7ad655a9d9df10]::clean::utils::display_macro_source
  18:        0x104975e54 - rustdoc[ed7ad655a9d9df10]::clean::inline::build_macro
  19:        0x104971ba4 - rustdoc[ed7ad655a9d9df10]::clean::inline::try_inline
  20:        0x104afb188 - rustdoc[ed7ad655a9d9df10]::clean::clean_use_statement_inner
  21:        0x104ae4b90 - <&mut rustdoc[ed7ad655a9d9df10]::clean::clean_doc_module::{closure#3} as core[7da8311a60047a04]::ops::function::FnOnce<((&(rustc_span[2e39c00920be160e]::def_id::DefId, core[7da8311a60047a04]::option::Option<rustc_span[2e39c00920be160e]::symbol::Symbol>), &(rustc_hir[6c499c7af7d6ca5f]::def::Res, rustc_span[2e39c00920be160e]::def_id::LocalDefId)),)>>::call_once
  22:        0x10490e918 - <alloc[dd56cb0eced0a665]::vec::Vec<rustdoc[ed7ad655a9d9df10]::clean::types::Item> as alloc[dd56cb0eced0a665]::vec::spec_extend::SpecExtend<rustdoc[ed7ad655a9d9df10]::clean::types::Item, core[7da8311a60047a04]::iter::adapters::flatten::FlatMap<indexmap[ad892cc7137e6a1e]::map::iter::Iter<(rustc_span[2e39c00920be160e]::def_id::DefId, core[7da8311a60047a04]::option::Option<rustc_span[2e39c00920be160e]::symbol::Symbol>), (rustc_hir[6c499c7af7d6ca5f]::def::Res, rustc_span[2e39c00920be160e]::def_id::LocalDefId)>, alloc[dd56cb0eced0a665]::vec::Vec<rustdoc[ed7ad655a9d9df10]::clean::types::Item>, rustdoc[ed7ad655a9d9df10]::clean::clean_doc_module::{closure#3}>>>::spec_extend
  23:        0x104aeef18 - rustdoc[ed7ad655a9d9df10]::clean::clean_doc_module
  24:        0x104acfdd4 - <&mut rustdoc[ed7ad655a9d9df10]::clean::clean_doc_module::{closure#1} as core[7da8311a60047a04]::ops::function::FnMut<(&rustdoc[ed7ad655a9d9df10]::visit_ast::Module,)>>::call_mut
  25:        0x10490e160 - <alloc[dd56cb0eced0a665]::vec::Vec<rustdoc[ed7ad655a9d9df10]::clean::types::Item> as alloc[dd56cb0eced0a665]::vec::spec_extend::SpecExtend<rustdoc[ed7ad655a9d9df10]::clean::types::Item, core[7da8311a60047a04]::iter::adapters::filter_map::FilterMap<core[7da8311a60047a04]::slice::iter::Iter<rustdoc[ed7ad655a9d9df10]::visit_ast::Module>, rustdoc[ed7ad655a9d9df10]::clean::clean_doc_module::{closure#1}>>>::spec_extend
  26:        0x104aeeeb8 - rustdoc[ed7ad655a9d9df10]::clean::clean_doc_module
  27:        0x1049df378 - rustdoc[ed7ad655a9d9df10]::clean::utils::krate
  28:        0x1047b77d8 - rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}::{closure#0}
  29:        0x1047564a4 - <std[46c86b5ae2734bc0]::thread::local::LocalKey<core[7da8311a60047a04]::cell::Cell<*const ()>>>::with::<rustc_middle[efb9ce11ad10696e]::ty::context::tls::enter_context<<rustc_middle[efb9ce11ad10696e]::ty::context::GlobalCtxt>::enter<rustc_interface[f8a9da9eabbd7651]::passes::create_and_enter_global_ctxt<(), rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}::{closure#0}>::{closure#2}::{closure#0}, ()>::{closure#1}, ()>::{closure#0}, ()>
  30:        0x104941164 - <rustc_middle[efb9ce11ad10696e]::ty::context::TyCtxt>::create_global_ctxt::<(), rustc_interface[f8a9da9eabbd7651]::passes::create_and_enter_global_ctxt<(), rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}::{closure#0}>::{closure#2}::{closure#0}>
  31:        0x1048fdb98 - rustc_interface[f8a9da9eabbd7651]::passes::create_and_enter_global_ctxt::<(), rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}::{closure#0}>
  32:        0x1047932ac - rustc_interface[f8a9da9eabbd7651]::interface::run_compiler::<(), rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}>::{closure#1}
  33:        0x10474b038 - rustc_span[2e39c00920be160e]::create_session_globals_then::<(), rustc_interface[f8a9da9eabbd7651]::util::run_in_thread_with_globals<rustc_interface[f8a9da9eabbd7651]::util::run_in_thread_pool_with_globals<rustc_interface[f8a9da9eabbd7651]::interface::run_compiler<(), rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
  34:        0x104a5421c - std[46c86b5ae2734bc0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f8a9da9eabbd7651]::util::run_in_thread_with_globals<rustc_interface[f8a9da9eabbd7651]::util::run_in_thread_pool_with_globals<rustc_interface[f8a9da9eabbd7651]::interface::run_compiler<(), rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  35:        0x104794e98 - <<std[46c86b5ae2734bc0]::thread::Builder>::spawn_unchecked_<rustc_interface[f8a9da9eabbd7651]::util::run_in_thread_with_globals<rustc_interface[f8a9da9eabbd7651]::util::run_in_thread_pool_with_globals<rustc_interface[f8a9da9eabbd7651]::interface::run_compiler<(), rustdoc[ed7ad655a9d9df10]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[7da8311a60047a04]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:        0x10d571f0c - std::sys::pal::unix::thread::Thread::new::thread_start::h42c5d8ed48c53b5a
  37:        0x19c4adc0c - __pthread_cond_wait

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 `/private/tmp/nix-build-rustc-1.86.0.drv-0/rustc-1.86.0-src/rustc-ice-2025-05-08T02_58_43-63498.txt` to your bug report

note: compiler flags: --crate-type lib -Z unstable-options -C codegen-units=10 -C symbol-mangling-version=legacy -Z unstable-options -C linker=/nix/store/7vyr5q4p1hb9ya1d7zsgikdfzbzjmk4c-clang-wrapper-19.1.7/bin/clang -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/1.86.0/") -Z crate-attr=warn(rust_2018_idioms) -Z unstable-options -Z force-unstable-if-unmarked

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

query stack during panic:
end of query stack
error: could not document `alloc`
warning: build failed, waiting for other jobs to finish...
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:02:46
make: *** [Makefile:20: all] Error 1
Backtrace

n/a at the moment, will get in the future

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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions