diff options
| author | Jeremy Fitzhardinge <jeremy@goop.org> | 2018-02-18 15:05:24 -0800 |
|---|---|---|
| committer | Jeremy Fitzhardinge <jsgf@fb.com> | 2018-02-22 15:13:21 -0800 |
| commit | 56a68285332000c858e9aeba7d66a4ec66ebff91 (patch) | |
| tree | 2eefbd5dddbb4458f91f1ca2eddb9eccb6850928 /src/doc | |
| parent | b1f8e6fb06d7362eeb2065347a7db94e76b1cb2f (diff) | |
| download | rust-56a68285332000c858e9aeba7d66a4ec66ebff91.tar.gz rust-56a68285332000c858e9aeba7d66a4ec66ebff91.zip | |
Implement --remap-path-prefix
Remove experimental -Zremap-path-prefix-from/to, and replace it with the stabilized --remap-path-prefix=from=to variant. This is an implementation for issue of #41555.
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/man/rustc.1 | 10 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/remap-path-prefix.md | 37 |
2 files changed, 10 insertions, 37 deletions
diff --git a/src/doc/man/rustc.1 b/src/doc/man/rustc.1 index 19f6cc9ac61..39d10539959 100644 --- a/src/doc/man/rustc.1 +++ b/src/doc/man/rustc.1 @@ -125,6 +125,16 @@ Print version info and exit. \fB\-v\fR, \fB\-\-verbose\fR Use verbose output. .TP +\fB\-\-remap\-path\-prefix\fR \fIfrom\fR=\fIto\fR +Remap source path prefixes in all output, including compiler diagnostics, debug information, +macro expansions, etc. The \fIfrom\fR=\fIto\fR parameter is scanned from right to left, so \fIfrom\fR +may contain '=', but \fIto\fR may not. + +This is useful for normalizing build products, for example by removing the current directory out of +pathnames emitted into the object files. The replacement is purely textual, with no consideration of +the current system's pathname syntax. For example \fI\-\-remap\-path\-prefix foo=bar\fR will +match \fBfoo/lib.rs\fR but not \fB./foo/lib.rs\fR. +.TP \fB\-\-extern\fR \fINAME\fR=\fIPATH\fR Specify where an external rust library is located. These should match \fIextern\fR declarations in the crate's source code. diff --git a/src/doc/unstable-book/src/compiler-flags/remap-path-prefix.md b/src/doc/unstable-book/src/compiler-flags/remap-path-prefix.md deleted file mode 100644 index 8ca04d25325..00000000000 --- a/src/doc/unstable-book/src/compiler-flags/remap-path-prefix.md +++ /dev/null @@ -1,37 +0,0 @@ -# `remap-path-prefix` - -The tracking issue for this feature is: [#41555](https://github.com/rust-lang/rust/issues/41555) - ------------------------- - -The `-Z remap-path-prefix-from`, `-Z remap-path-prefix-to` commandline option -pair allows to replace prefixes of any file paths the compiler emits in various -places. This is useful for bringing debuginfo paths into a well-known form and -for achieving reproducible builds independent of the directory the compiler was -executed in. All paths emitted by the compiler are affected, including those in -error messages. - -In order to map all paths starting with `/home/foo/my-project/src` to -`/sources/my-project`, one would invoke the compiler as follows: - -```text -rustc -Zremap-path-prefix-from="/home/foo/my-project/src" -Zremap-path-prefix-to="/sources/my-project" -``` - -Debuginfo for code from the file `/home/foo/my-project/src/foo/mod.rs`, -for example, would then point debuggers to `/sources/my-project/foo/mod.rs` -instead of the original file. - -The options can be specified multiple times when multiple prefixes should be -mapped: - -```text -rustc -Zremap-path-prefix-from="/home/foo/my-project/src" \ - -Zremap-path-prefix-to="/sources/my-project" \ - -Zremap-path-prefix-from="/home/foo/my-project/build-dir" \ - -Zremap-path-prefix-to="/stable-build-dir" -``` - -When the options are given multiple times, the nth `-from` will be matched up -with the nth `-to` and they can appear anywhere on the commandline. Mappings -specified later on the line will take precedence over earlier ones. |
