Skip to content

Commit 8e33a46

Browse files
committed
Use names instead of numbers for trim-paths options
1 parent aee42a6 commit 8e33a46

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

text/3127-trim-paths.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,19 @@ This flag accepts a comma-separated list of values and may be specified multiple
101101
## Cargo
102102

103103
`trim-paths` is a profile setting which controls the sanitisation of file paths in compilation outputs. It has three valid options:
104-
- `0` or `false`: no sanitisation at all
105-
- `1`: sanitise only the paths in emitted executable or library binaries. It always affects paths from macros such as panic messages, and in debug information
104+
- `none` or `false`: no sanitisation at all
105+
- `object`: sanitise only the paths in emitted executable or library binaries. It always affects paths from macros such as panic messages, and in debug information
106106
only if they will be embedded together with the binary (the default on platforms with ELF binaries, such as Linux and windows-gnu),
107107
but will not touch them if they are in separate files (the default on Windows MSVC and macOS). But the path to these separate files are sanitised.
108-
- `2` or `true`: sanitise paths in all compilation outputs, including compiled executable/library, debug information, and compiler diagnostics.
108+
- `all` or `true`: sanitise paths in all compilation outputs, including compiled executable/library, debug information, and compiler diagnostics.
109109

110-
The default release profile uses option `1`. You can also manually override it by specifying this option in `Cargo.toml`:
110+
The default release profile uses option `object`. You can also manually override it by specifying this option in `Cargo.toml`:
111111
```toml
112112
[profile.dev]
113-
trim-paths = 2
113+
trim-paths = all
114114

115115
[profile.release]
116-
trim-paths = 0
116+
trim-paths = none
117117
```
118118

119119
When a path is in scope for sanitisation, it is handled by the following rules:
@@ -137,20 +137,20 @@ This will not affect any hard-coded paths in the source code.
137137

138138
We only need to change the behaviour for `Test` and `Build` compile modes.
139139

140-
If `trim-paths` is `0` (`false`), no extra flag is supplied to `rustc`.
140+
If `trim-paths` is `none` (`false`), no extra flag is supplied to `rustc`.
141141

142-
If `trim-paths` is `1` or `2` (`true`), then two `--remap-path-prefix` arguments are supplied to `rustc`:
142+
If `trim-paths` is `object` or `all` (`true`), then two `--remap-path-prefix` arguments are supplied to `rustc`:
143143
- From the path of the local sysroot to `/rustc/[commit hash]`.
144144
- If the compilation unit is under the working directory, from the the working directory absolute path to empty string.
145145
If it's outside the working directory, from the absolute path of the package root to `[package name]-[package version]`.
146146

147-
A further `--remap-path-scope` is also supplied for options `1` and `2`:
147+
A further `--remap-path-scope` is also supplied for options `object` and `all`:
148148

149-
If `trim-path` is `1`, then `--remap-path-scope=macro,unsplit-debuginfo,split-debuginfo-file`.
149+
If `trim-path` is `object`, then `--remap-path-scope=macro,unsplit-debuginfo,split-debuginfo-file`.
150150

151151
As a result, panic messages (which are always embedded) are sanitised. If debug information is embedded, then they are sanitised; if they are split then they are kept untouched, but the paths to these split files are sanitised.
152152

153-
If `trim-path` is `2` (`true`), all paths will be affected, equivalent to `--remap-path-scope=macro,debuginfo,diagnostics,split-debuginfo-file`
153+
If `trim-path` is `all` (`true`), all paths will be affected, equivalent to `--remap-path-scope=macro,debuginfo,diagnostics,split-debuginfo-file`
154154

155155

156156
Some interactions with compiler-intrinsic macros need to be considered:

0 commit comments

Comments
 (0)