Fix ICE: attempted to remap an already remapped filename#138556
Merged
bors merged 1 commit intorust-lang:masterfrom Mar 18, 2025
Merged
Fix ICE: attempted to remap an already remapped filename#138556bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
Urgau
reviewed
Mar 16, 2025
e5e767e to
1d96771
Compare
Urgau
reviewed
Mar 16, 2025
Contributor
|
Reassigning the review to @Urgau, who has stronger opinions and more expertise here than I do. |
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 rust-lang#138520 Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
1d96771 to
b148106
Compare
GuillaumeGomez
approved these changes
Mar 17, 2025
Member
|
Looks good to me, thanks for working on this! I'll let @Urgau have the final word. |
Urgau
approved these changes
Mar 17, 2025
Member
|
@bors r=GuillaumeGomez,Urgau rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 18, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138384 (Move `hir::Item::ident` into `hir::ItemKind`.) - rust-lang#138508 (Clarify "owned data" in E0515.md) - rust-lang#138531 (Store test diffs in job summaries and improve analysis formatting) - rust-lang#138533 (Only use `DIST_TRY_BUILD` for try jobs that were not selected explicitly) - rust-lang#138556 (Fix ICE: attempted to remap an already remapped filename) - rust-lang#138608 (rustc_target: Add target feature constraints for LoongArch) - rust-lang#138619 (Flatten `if`s in `rustc_codegen_ssa`) r? `@ghost` `@rustbot` modify labels: rollup
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Mar 18, 2025
…e, r=GuillaumeGomez,Urgau 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 rust-lang#138520
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Mar 18, 2025
…e, r=GuillaumeGomez,Urgau 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 rust-lang#138520
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 18, 2025
Rollup of 7 pull requests Successful merges: - rust-lang#136320 (exit: document interaction with C) - rust-lang#138301 (Implement `read_buf` for Hermit) - rust-lang#138508 (Clarify "owned data" in E0515.md) - rust-lang#138556 (Fix ICE: attempted to remap an already remapped filename) - rust-lang#138569 (rustdoc-json: Add tests for `#[repr(...)]`) - rust-lang#138608 (rustc_target: Add target feature constraints for LoongArch) - rust-lang#138619 (Flatten `if`s in `rustc_codegen_ssa`) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 18, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138384 (Move `hir::Item::ident` into `hir::ItemKind`.) - rust-lang#138508 (Clarify "owned data" in E0515.md) - rust-lang#138531 (Store test diffs in job summaries and improve analysis formatting) - rust-lang#138533 (Only use `DIST_TRY_BUILD` for try jobs that were not selected explicitly) - rust-lang#138556 (Fix ICE: attempted to remap an already remapped filename) - rust-lang#138608 (rustc_target: Add target feature constraints for LoongArch) - rust-lang#138619 (Flatten `if`s in `rustc_codegen_ssa`) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 18, 2025
Rollup merge of rust-lang#138556 - charmitro:already-remapped-filename, r=GuillaumeGomez,Urgau 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 rust-lang#138520
27 tasks
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Mar 20, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138384 (Move `hir::Item::ident` into `hir::ItemKind`.) - rust-lang#138508 (Clarify "owned data" in E0515.md) - rust-lang#138531 (Store test diffs in job summaries and improve analysis formatting) - rust-lang#138533 (Only use `DIST_TRY_BUILD` for try jobs that were not selected explicitly) - rust-lang#138556 (Fix ICE: attempted to remap an already remapped filename) - rust-lang#138608 (rustc_target: Add target feature constraints for LoongArch) - rust-lang#138619 (Flatten `if`s in `rustc_codegen_ssa`) r? `@ghost` `@rustbot` modify labels: rollup
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Mar 31, 2026
With the minimum version bump in place, `rustdoc` now always recognizes the `--remap-path-prefix` flag. In addition, the Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2], so we still need to skip the flag for the normal `rustdoc` case, but not for `--test` since the ICE does not reproduce there -- please see commit 2c8725c ("rust: kbuild: skip `--remap-path-prefix` for `rustdoc`"). Thus update the comment and remove the skipping of the flag for the `--test` case. Note that commit dda1350 ("rust: build: remap path to avoid absolute path") re-landed the `--remap-path-prefix` flag (together with `--remap-path-scope`), so we keep the workaround, i.e. an alternative could have been to simply delete the skip entirely, but since we still have it and it will be needed when this gets merged, let's keep it. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Mar 31, 2026
The Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2]. And, for other workarounds, we plan on limiting where we apply them [3]. Thus limit the ICE one too. This will help to make sure the workaround is not needed anymore on newer versions. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Link: https://lore.kernel.org/rust-for-linux/20260205131815.2943152-2-mlksvender@gmail.com/ [3] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Mar 31, 2026
With the minimum version bump in place, `rustdoc` now always recognizes the `--remap-path-prefix` flag. In addition, the Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2], so we still need to skip the flag for the normal `rustdoc` case, but not for `--test` since the ICE does not reproduce there -- please see commit 2c8725c ("rust: kbuild: skip `--remap-path-prefix` for `rustdoc`"). Thus update the comment and remove the skipping of the flag for the `--test` case. Note that commit dda1350 ("rust: build: remap path to avoid absolute path") re-landed the `--remap-path-prefix` flag (together with `--remap-path-scope`), so we keep the workaround, i.e. an alternative could have been to simply delete the skip entirely, but since we still have it and it will be needed when this gets merged, let's keep it. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Mar 31, 2026
The Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2]. And, for other workarounds, we plan on limiting where we apply them [3]. Thus limit the ICE one too. This will help to make sure the workaround is not needed anymore on newer versions. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Link: https://lore.kernel.org/rust-for-linux/20260205131815.2943152-2-mlksvender@gmail.com/ [3] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Apr 1, 2026
With the minimum version bump in place, `rustdoc` now always recognizes the `--remap-path-prefix` flag. In addition, the Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2], so we still need to skip the flag for the normal `rustdoc` case, but not for `--test` since the ICE does not reproduce there -- please see commit 2c8725c ("rust: kbuild: skip `--remap-path-prefix` for `rustdoc`"). Thus update the comment and remove the skipping of the flag for the `--test` case. Note that commit dda1350 ("rust: build: remap path to avoid absolute path") re-landed the `--remap-path-prefix` flag (together with `--remap-path-scope`), so we keep the workaround, i.e. an alternative could have been to simply delete the skip entirely, but since we still have it and it will be needed when this gets merged, let's keep it. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Apr 1, 2026
The Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2]. And, for other workarounds, we plan on limiting where we apply them [3]. Thus limit the ICE one too. This will help to make sure the workaround is not needed anymore on newer versions. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Link: https://lore.kernel.org/rust-for-linux/20260205131815.2943152-2-mlksvender@gmail.com/ [3] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Darksonn
pushed a commit
to Darksonn/linux
that referenced
this pull request
Apr 1, 2026
With the minimum version bump in place, `rustdoc` now always recognizes the `--remap-path-prefix` flag. In addition, the Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2], so we still need to skip the flag for the normal `rustdoc` case, but not for `--test` since the ICE does not reproduce there -- please see commit 2c8725c ("rust: kbuild: skip `--remap-path-prefix` for `rustdoc`"). Thus update the comment and remove the skipping of the flag for the `--test` case. Note that commit dda1350 ("rust: build: remap path to avoid absolute path") re-landed the `--remap-path-prefix` flag (together with `--remap-path-scope`), so we keep the workaround, i.e. an alternative could have been to simply delete the skip entirely, but since we still have it and it will be needed when this gets merged, let's keep it. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20260401114540.30108-9-ojeda@kernel.org Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Darksonn
pushed a commit
to Darksonn/linux
that referenced
this pull request
Apr 1, 2026
The Internal Compiler Error that the comment mentions [1] was fixed in Rust 1.87.0 [2]. And, for other workarounds, we plan on limiting where we apply them [3]. Thus limit the ICE one too. This will help to make sure the workaround is not needed anymore on newer versions. Link: rust-lang/rust#138520 [1] Link: rust-lang/rust#138556 [2] Link: https://lore.kernel.org/rust-for-linux/20260205131815.2943152-2-mlksvender@gmail.com/ [3] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20260401114540.30108-10-ojeda@kernel.org Signed-off-by: Alice Ryhl <aliceryhl@google.com>
ojeda
added a commit
to Rust-for-Linux/linux
that referenced
this pull request
Apr 6, 2026
Commit 8cf5b3f ("Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"") removed `--remap-path-prefix` from the build system, so the workarounds are not needed anymore. Thus remove them. Note that the flag has landed again in parallel in this cycle in commit dda1350 ("rust: build: remap path to avoid absolute path"), together with `--remap-path-scope=macro` [1]. However, they are gated on `rustc-option-yn, --remap-path-scope=macro`, which means they are both only passed starting with Rust 1.95.0 [2]: `--remap-path-scope` is only stable in Rust 1.95, so use `rustc-option` to detect its presence. This feature has been available as `-Zremap-path-scope` for all versions that we support; however due to bugs in the Rust compiler, it does not work reliably until 1.94. I opted to not enable it for 1.94 as it's just a single version that we missed. In turn, that means the workarounds removed here should not be needed again (even with the flag added again above), since: - `rustdoc` now recognizes the `--remap-path-prefix` flag since Rust 1.81.0 [3] (even if it is still an unstable feature [4]). - The Internal Compiler Error [5] that the comment mentions was fixed in Rust 1.87.0 [6]. We tested that was the case in a previous version of this series by making the workaround conditional [7][8]. ...which are both older versions than Rust 1.95.0. We will still need to skip `--remap-path-scope` for `rustdoc` though, since `rustdoc` does not support that one yet [4]. Link: rust-lang/rust#111540 [1] Link: rust-lang/rust#147611 [2] Link: rust-lang/rust#107099 [3] Link: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--remap-path-prefix-remap-source-code-paths-in-output [4] Link: rust-lang/rust#138520 [5] Link: rust-lang/rust#138556 [6] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-9-ojeda@kernel.org/ [7] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-10-ojeda@kernel.org/ [8] Acked-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260405235309.418950-2-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
added a commit
to Rust-for-Linux/linux
that referenced
this pull request
Apr 7, 2026
Commit 8cf5b3f ("Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"") removed `--remap-path-prefix` from the build system, so the workarounds are not needed anymore. Thus remove them. Note that the flag has landed again in parallel in this cycle in commit dda1350 ("rust: build: remap path to avoid absolute path"), together with `--remap-path-scope=macro` [1]. However, they are gated on `rustc-option-yn, --remap-path-scope=macro`, which means they are both only passed starting with Rust 1.95.0 [2]: `--remap-path-scope` is only stable in Rust 1.95, so use `rustc-option` to detect its presence. This feature has been available as `-Zremap-path-scope` for all versions that we support; however due to bugs in the Rust compiler, it does not work reliably until 1.94. I opted to not enable it for 1.94 as it's just a single version that we missed. In turn, that means the workarounds removed here should not be needed again (even with the flag added again above), since: - `rustdoc` now recognizes the `--remap-path-prefix` flag since Rust 1.81.0 [3] (even if it is still an unstable feature [4]). - The Internal Compiler Error [5] that the comment mentions was fixed in Rust 1.87.0 [6]. We tested that was the case in a previous version of this series by making the workaround conditional [7][8]. ...which are both older versions than Rust 1.95.0. We will still need to skip `--remap-path-scope` for `rustdoc` though, since `rustdoc` does not support that one yet [4]. Link: rust-lang/rust#111540 [1] Link: rust-lang/rust#147611 [2] Link: rust-lang/rust#107099 [3] Link: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--remap-path-prefix-remap-source-code-paths-in-output [4] Link: rust-lang/rust#138520 [5] Link: rust-lang/rust#138556 [6] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-9-ojeda@kernel.org/ [7] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-10-ojeda@kernel.org/ [8] Link: https://patch.msgid.link/20260405235309.418950-2-ojeda@kernel.org Acked-by: Gary Guo <gary@garyguo.net> Reviewed-by: Tamir Duberstein <tamird@kernel.org> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-prefixoption wasused.
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