Skip to content

Commit c196537

Browse files
committed
[RFC 3127 - Trim Paths]: Add documentation for -Zremap-path-scope
1 parent dd5aeec commit c196537

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# `remap-path-scope`
2+
3+
The tracking issue for this feature is: [#111540](https://github.com/rust-lang/rust/issues/111540).
4+
5+
------------------------
6+
7+
When the `--remap-path-prefix` option is passed to rustc, source path prefixes in all output will be affected by default.
8+
The `--remap-path-scope` argument can be used in conjunction with `--remap-path-prefix` to determine paths in which output context should be affected.
9+
This flag accepts a comma-separated list of values and may be specified multiple times, in which case the scopes are aggregated together. The valid scopes are:
10+
11+
- `macro` - apply remappings to the expansion of `std::file!()` macro. This is where paths in embedded panic messages come from
12+
- `diagnostics` - apply remappings to printed compiler diagnostics
13+
- `unsplit-debuginfo` - apply remappings to debug information only when they are written to compiled executables or libraries, but not when they are in split debuginfo files
14+
- `split-debuginfo` - apply remappings to debug information only when they are written to split debug information files, but not in compiled executables or libraries
15+
- `split-debuginfo-path` - apply remappings to the paths pointing to split debug information files. Does nothing when these files are not generated.
16+
- `object` - an alias for `macro,unsplit-debuginfo,split-debuginfo-path`. This ensures all paths in compiled executables or libraries are remapped, but not elsewhere.
17+
- `all` and `true` - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
18+
19+
## Example
20+
```sh
21+
# This would produce an absolute path to main.rs in build outputs of
22+
# "./main.rs".
23+
rustc --remap-path-prefix=$(PWD)=/remapped -Zremap-path-prefix=object main.rs
24+
```

0 commit comments

Comments
 (0)