about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-19 19:09:29 +0000
committerbors <bors@rust-lang.org>2023-10-19 19:09:29 +0000
commit94c4e5c4111cbefcd098d6efcb0b222b6e512fcb (patch)
tree550103880907fc185bae80be8a49624458319147 /src/doc
parente76cb8c49831ff80d7d2e16319c86edbaa9edb8c (diff)
parent5c41de113e8484085fbc01cf6d5a0b16159110a7 (diff)
downloadrust-94c4e5c4111cbefcd098d6efcb0b222b6e512fcb.tar.gz
rust-94c4e5c4111cbefcd098d6efcb0b222b6e512fcb.zip
Auto merge of #115214 - Urgau:rfc-3127-trim-paths, r=compiler-errors
Implement rustc part of RFC 3127 trim-paths

This PR implements (or at least tries to) [RFC 3127 trim-paths](https://github.com/rust-lang/rust/issues/111540), the rustc part. That is `-Zremap-path-scope` with all of it's components/scopes.

`@rustbot` label: +F-trim-paths
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/compiler-flags/remap-path-scope.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/remap-path-scope.md b/src/doc/unstable-book/src/compiler-flags/remap-path-scope.md
new file mode 100644
index 00000000000..13349ff6b8f
--- /dev/null
+++ b/src/doc/unstable-book/src/compiler-flags/remap-path-scope.md
@@ -0,0 +1,24 @@
+# `remap-path-scope`
+
+The tracking issue for this feature is: [#111540](https://github.com/rust-lang/rust/issues/111540).
+
+------------------------
+
+When the `--remap-path-prefix` option is passed to rustc, source path prefixes in all output will be affected by default.
+The `--remap-path-scope` argument can be used in conjunction with `--remap-path-prefix` to determine paths in which output context should be affected.
+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:
+
+- `macro` - apply remappings to the expansion of `std::file!()` macro. This is where paths in embedded panic messages come from
+- `diagnostics` - apply remappings to printed compiler diagnostics
+- `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
+- `split-debuginfo` - apply remappings to debug information only when they are written to split debug information files, but not in compiled executables or libraries
+- `split-debuginfo-path` - apply remappings to the paths pointing to split debug information files. Does nothing when these files are not generated.
+- `object` - an alias for `macro,unsplit-debuginfo,split-debuginfo-path`. This ensures all paths in compiled executables or libraries are remapped, but not elsewhere.
+- `all` and `true` - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
+
+## Example
+```sh
+# This would produce an absolute path to main.rs in build outputs of
+# "./main.rs".
+rustc --remap-path-prefix=$(PWD)=/remapped -Zremap-path-prefix=object main.rs
+```