Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/doc/rustc/src/remap-source-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ The replacement is purely textual, with no consideration of the current system's

When multiple remappings are given and several of them match, the **last** matching one is applied.

### Relative paths

Some build systems, such as Cargo, may compile crates using relative paths (for example,
`src/main.rs` instead of `/home/user/project/src/main.rs)`.

`rustc` preserves these relative paths where possible. However, certain inputs
(like `#[path = "..."]`) and outputs (such as debug information) may still contain absolute paths.

To ensure consistency, it’s recommended to remap both relative and absolute paths.

```bash
rustc --remap-path-prefix "src/=/redacted/src" --remap-path-prefix "/home/user/project=/redacted"
```

### Example

```bash
Expand Down
Loading