Skip to content

trim-paths = "all" causes rustdoc ICE #137929

@crumblingstatue

Description

@crumblingstatue

Create a new crate with trim-paths enabled in dev profile, and a dependency to document

cargo-features = ["trim-paths"] [package] name = "mycrate" version = "0.1.0" edition = "2024" [dependencies] rand = "0.9.0" [profile.dev] trim-paths = "all" 

Then run cargo doc:

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: 0x775a58dc0254 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h3be2c55d6a7a5a34 1: 0x775a596057e2 - core::fmt::write::heaa2b36cc46f6889 2: 0x775a5a662e51 - std::io::Write::write_fmt::hb8fb683eabe871c6 3: 0x775a58dc00b2 - std::sys::backtrace::BacktraceLock::print::hd704bdc52d7c9664 4: 0x775a58dc2992 - std::panicking::default_hook::{{closure}}::h86d214d37625ccef 5: 0x775a58dc2584 - std::panicking::default_hook::hd3062d8e931a2e9b 6: 0x775a57f19727 - std[322f37fcc2b9f49b]::panicking::update_hook::<alloc[ea91e9164aa8db50]::boxed::Box<rustc_driver_impl[736c71ff470121c4]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x775a58dc3203 - std::panicking::rust_panic_with_hook::hd8771e6462753058 8: 0x775a58dc2ec6 - std::panicking::begin_panic_handler::{{closure}}::he55918b575a6ccdf 9: 0x775a58dc0719 - std::sys::backtrace::__rust_end_short_backtrace::hc6ec34c89592e335 10: 0x775a58dc2bbd - rust_begin_unwind 11: 0x775a55a5b900 - core::panicking::panic_fmt::hefc6173b60ee1f81 12: 0x775a5a0672bb - <rustc_span[fca1d8614d9b563e]::source_map::FilePathMapping>::map_filename_prefix 13: 0x775a5a0673f7 - <rustc_span[fca1d8614d9b563e]::source_map::SourceMap>::new_source_file 14: 0x775a5a6f9b61 - rustc_parse[13c8da5e6cdcd04d]::new_parser_from_source_str 15: 0x58ddbee0b3d2 - rustdoc[7b623c6b10481630]::clean::render_macro_matchers::render_macro_matcher 16: 0x58ddbee1cb16 - rustdoc[7b623c6b10481630]::clean::utils::render_macro_arms::<core[3b229a6eca4766de]::iter::adapters::map::Map<core[3b229a6eca4766de]::slice::iter::Chunks<rustc_ast[ab7768c16cfbf683]::tokenstream::TokenTree>, rustdoc[7b623c6b10481630]::clean::utils::display_macro_source::{closure#0}>> 17: 0x58ddbee1ccf4 - rustdoc[7b623c6b10481630]::clean::utils::display_macro_source 18: 0x58ddbee3421d - rustdoc[7b623c6b10481630]::clean::clean_maybe_renamed_item::{closure#1} 19: 0x58ddbee1dcd2 - rustdoc[7b623c6b10481630]::clean::clean_doc_module 20: 0x58ddbeb91836 - <rustc_session[1572583034bdd29b]::session::Session>::time::<rustdoc[7b623c6b10481630]::clean::types::Crate, rustdoc[7b623c6b10481630]::core::run_global_ctxt::{closure#4}> 21: 0x58ddbee46f99 - rustdoc[7b623c6b10481630]::core::run_global_ctxt 22: 0x58ddbef69ff1 - rustdoc[7b623c6b10481630]::main_args::{closure#2}::{closure#0} 23: 0x58ddbecdc6f8 - rustc_interface[98bd23133177d71]::interface::run_compiler::<(), rustdoc[7b623c6b10481630]::main_args::{closure#2}>::{closure#1} 24: 0x58ddbec5e781 - std[322f37fcc2b9f49b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[98bd23133177d71]::util::run_in_thread_with_globals<rustc_interface[98bd23133177d71]::util::run_in_thread_pool_with_globals<rustc_interface[98bd23133177d71]::interface::run_compiler<(), rustdoc[7b623c6b10481630]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 25: 0x58ddbecf238d - <<std[322f37fcc2b9f49b]::thread::Builder>::spawn_unchecked_<rustc_interface[98bd23133177d71]::util::run_in_thread_with_globals<rustc_interface[98bd23133177d71]::util::run_in_thread_pool_with_globals<rustc_interface[98bd23133177d71]::interface::run_compiler<(), rustdoc[7b623c6b10481630]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[3b229a6eca4766de]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 26: 0x775a5a5808b7 - std::sys::pal::unix::thread::Thread::new::thread_start::hf1d8e833b2661b6d 27: 0x775a545ab70a - <unknown> 28: 0x775a5462faac - <unknown> 29: 0x0 - <unknown>

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (f4a216d28 2025-03-02) binary: rustc commit-hash: f4a216d28ee635afce685b4206e713579f66e130 commit-date: 2025-03-02 host: x86_64-unknown-linux-gnu release: 1.87.0-nightly LLVM version: 20.1.0 

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-trim-pathsFeature: trim-pathsT-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