Skip to content

Commit 998ecf4

Browse files
committed
Add scoped mapping discussion
1 parent 2bd2792 commit 998ecf4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

text/3127-trim-paths.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,9 @@ Path to sysroot crates are specially handled by `rustc`. Due to this, the behavi
202202
Although good for privacy and reproducibility, some people find it a hinderance for debugging: https://github.com/rust-lang/rust/issues/85463.
203203
Hence the user should be given control on if they want the virtual or local path.
204204

205-
An alternative to `--remap-path-scope` is to have individual `--remap-path-prefix`-like flags, one each for macro, debuginfo and diagnostics, requiring
206-
the full mapping to be given for each context. This is similar to what GCC and Clang does as described below, but we have added a third context
207-
for diagnostics. This technically enables for even finer grained control, allowing different paths in different
208-
contexts to be remapped differently. However it will cause the command line to be very verbose under most normal use cases.
205+
An alternative is to extend the syntax accepted by `--remap-path-prefix` or add a new option called `--remap-path-prefix-scoped` which allows
206+
scoping rules to be explicitly applied to each remapping. This can co-exist with `--remap-path-scope` so it will be discussed further in
207+
[Future possibilities](#future-possibilities) section.
209208

210209
# Prior art
211210
[prior-art]: #prior-art
@@ -233,4 +232,13 @@ the other for only debuginfo: https://reproducible-builds.org/docs/build-path/.
233232
# Future possibilities
234233
[future-possibilities]: #future-possibilities
235234

236-
N/A
235+
If it turns out that we want to enable finer grained scoping control on each individual remapping, we could use a `scopes:from=to` syntax.
236+
E.g. `debuginfo,diagnostics:/path/to/src=src` will remove all references to `/path/to/src` from compiler diagnostics and debug information, but
237+
they are retained panic messages. This syntax can be used with either a brand new `--remap-path-prefix-scoped` option, or we could extend the
238+
existing `--remap-path-prefix` option to take in this new syntax.
239+
240+
If we were to extend the existing `--remap-path-prefix`, there may be an ambiguity to whether `:` means a separator between scope list and mapping,
241+
or is it a part of the path; if the first `:` supplied belongs to the path then it would have to be escaped. This coudl be technically breaking.
242+
243+
In any case, future inclusion of this new syntax will not affect `--remap-path-scope` introduced in this RFC. Scopes specified in `--remap-path-scope`
244+
will be used as default for all mappings, and explicit scopes for an individual mapping will take precedence on that mapping.

0 commit comments

Comments
 (0)