rust/tests/rustdoc-ui/remap-path-prefix-macro.rs
Charalampos Mitrodimas b14810669a Fix ICE: attempted to remap an already remapped filename
This commit fixes an internal compiler error (ICE) that occurs when
rustdoc attempts to process macros with a remapped filename. The issue
arose during macro expansion when the `--remap-path-prefix` option was
used.

Instead of passing remapped filenames through, which would trigger the
"attempted to remap an already remapped filename" panic, we now
extract the original local path from remapped filenames before
processing them.

A test case has been added to verify this behavior.

Fixes #138520

Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
2025-03-16 23:37:09 +01:00

9 lines
356 B
Rust

// Regression test for "attempted to remap an already remapped filename" ICE in rustdoc
// when using --remap-path-prefix with macro rendering.
// <https://github.com/rust-lang/rust/issues/138520>
//@ compile-flags:-Z unstable-options --remap-path-prefix={{src-base}}=remapped_path
//@ rustc-env:RUST_BACKTRACE=0
//@ build-pass
macro_rules! f(() => {});