about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2021-09-15 14:56:56 -0700
committerGitHub <noreply@github.com>2021-09-15 14:56:56 -0700
commit84646e9d67a5941d52bfa5a2ae4e4e29e30808fe (patch)
treebe6d6c700cdf9366c960a57da1432f75a1852e12 /src/doc
parent2c7bc5e33c25e29058cbafefe680da8d5e9220e9 (diff)
parentc0118289efbd3d0c61ae8912426a211e53abe208 (diff)
downloadrust-84646e9d67a5941d52bfa5a2ae4e4e29e30808fe.tar.gz
rust-84646e9d67a5941d52bfa5a2ae4e4e29e30808fe.zip
Rollup merge of #87320 - danakj:debug-compilation-dir, r=michaelwoerister
Introduce -Z remap-cwd-prefix switch

This switch remaps any absolute paths rooted under the current
working directory to a new value. This includes remapping the
debug info in `DW_AT_comp_dir` and `DW_AT_decl_file`.

Importantly, this flag does not require passing the current working
directory to the compiler, such that the command line can be
run on any machine (with the same input files) and produce the
same results. This is critical property for debugging compiler
issues that crop up on remote machines.

This is based on adetaylor's https://github.com/rust-lang/rust/commit/dbc4ae7cba0ba8d650b91ddd459b86a02a2d05c5

Major Change Proposal: https://github.com/rust-lang/compiler-team/issues/450
Discussed on #38322. Would resolve issue #87325.
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/compiler-flags/remap-cwd-prefix.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/remap-cwd-prefix.md b/src/doc/unstable-book/src/compiler-flags/remap-cwd-prefix.md
new file mode 100644
index 00000000000..977d258529f
--- /dev/null
+++ b/src/doc/unstable-book/src/compiler-flags/remap-cwd-prefix.md
@@ -0,0 +1,24 @@
+# `remap-cwd-prefix`
+
+The tracking issue for this feature is: [#87325](https://github.com/rust-lang/rust/issues/87325).
+
+------------------------
+
+This flag will rewrite absolute paths under the current working directory,
+replacing the current working directory prefix with a specified value.
+
+The given value may be absolute or relative, or empty. This switch takes
+precidence over `--remap-path-prefix` in case they would both match a given
+path.
+
+This flag helps to produce deterministic output, by removing the current working
+directory from build output, while allowing the command line to be universally
+reproducible, such that the same execution will work on all machines, regardless
+of build environment.
+
+## Example
+```sh
+# This would produce an absolute path to main.rs in build outputs of
+# "./main.rs".
+rustc -Z remap-cwd-prefix=. main.rs
+```