You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/3127-trim-paths.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,19 +101,19 @@ This flag accepts a comma-separated list of values and may be specified multiple
101
101
## Cargo
102
102
103
103
`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
106
106
only if they will be embedded together with the binary (the default on platforms with ELF binaries, such as Linux and windows-gnu),
107
107
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.
109
109
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`:
111
111
```toml
112
112
[profile.dev]
113
-
trim-paths = 2
113
+
trim-paths = all
114
114
115
115
[profile.release]
116
-
trim-paths = 0
116
+
trim-paths = none
117
117
```
118
118
119
119
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.
137
137
138
138
We only need to change the behaviour for `Test` and `Build` compile modes.
139
139
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`.
141
141
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`:
143
143
- From the path of the local sysroot to `/rustc/[commit hash]`.
144
144
- If the compilation unit is under the working directory, from the the working directory absolute path to empty string.
145
145
If it's outside the working directory, from the absolute path of the package root to `[package name]-[package version]`.
146
146
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`:
148
148
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`.
150
150
151
151
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.
152
152
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`
154
154
155
155
156
156
Some interactions with compiler-intrinsic macros need to be considered:
0 commit comments