-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Stabilize -Zremap-path-scope
#147611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Stabilize -Zremap-path-scope
#147611
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for driving the stabilization!
There are outstanding bugs regarding --remap-path-scope.
"There are no outstanding bugs" probably?
Nightly use
Do any known nightly users use this feature? Counting instances of
#![feature(FEATURE_NAME)]on GitHub with grep might be informative.Except for Cargo unstable
trim-pathsthere doesn't appear any committed use on GitHub.
Don't want to block the stabilization. However, this sounds a bit odd that there is no major use cases beyond Cargo and rustc is heading toward stabilization alone. That may imply t-cargo should review again whether --remap-path-scope is useful and cover what they want at least (of course this is on me as I worked on Cargo side of this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"There are no outstanding bugs" probably?
As far as I know --remap-path-scope has no bugs. We have test for all the scopes, with/without dependency and with mixed scopes between crates.
However, this sounds a bit odd that there is no major use cases beyond Cargo and rustc is heading toward stabilization alone.
It doesn't really surprises me that there are no public use of it. It's quite a pain currently to setup --remap-path-prefix and -Zremap-path-scope in Cargo, as there is currently no support for it, which is what we are trying to solve. I suspect most users are using RUSTFLAGS which I don't think is typically committed.
That may imply t-cargo should review again whether
--remap-path-scopeis useful
Well, be able to see the not-remapped paths in diagnostics is quite nice thing.
The RFC specifically states that the default should be object for the release profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"There are no outstanding bugs" probably?
I meant the "no" is missing in the original PR description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other thing is that do we want to stabilize all options all at once. I remember that the RFC said we could optionally stabilize some of them. I am not sure whether macros and debuginfo standalone are useful, as well as diagnostics. The most useful thing as you mentioned is probably object and the original behavior all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know that macros or debuginfo would need to be useful on their own to be worth stabilising, we're able to support them relatively straightforwardly and they may be useful in combination with other options.
ac9448d to
bcbf54a
Compare
|
Currently the (Historically I believe they were under Tools like
|
We should document that new coverage scopes may be added in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation LGTM
|
@rfcbot fcp merge |
|
Team member @davidtwco has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
|
I don't see this discussed here, but would specifying different remappings for each of the scope be something that somebody might want to do? If this came up, how would this design evolve to support such a use-case? |
|
Regarding #147611 (comment):
This PR only stabilizes People using custom remap prefixes1 already needs to manually any tell the tools they use how to un-remap the different prefixes they used.
As proposed by David I have adjusted the documentation to mention that the list of scopes is not exhaustive and may be increased in the future. Footnotes |
This is sub-optimal indeed :-/ We should either create a dedicated scope for it or put it under EDIT: This has now been done in this PR. There is now a
Note that contrary to the RFC, the |
It's been mentioned in #142917, but only as a workaround for some current limitations1 and I prefer fixing the limitations rather than introducing workarounds. Therefore, handling different remappings for each scope has not been very well thought out, but if we wanted to do that in the future I think we should do it on Footnotes
|
Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
582dee3 to
3b5b4b6
Compare
This comment has been minimized.
This comment has been minimized.
3b5b4b6 to
2d91dbe
Compare
2d91dbe to
7c8639f
Compare
| - `object` - apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias for `macro,coverage,debuginfo`. | ||
| - `all` (default) - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`. | ||
|
|
||
| The scopes accepted by `--remap-path-scope` are not exhaustive - new scopes may be added in future releases for eventual stabilisation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this is probably obvious, but it might be worth spelling out that, by implication, all thus necessarily can correspond to different scopes between releases.
Stabilization report of
--remap-path-scopeSummary
RFC 3127 trim-paths aims to improve the current status of sanitizing paths emitted by the compiler via the
--remap-path-prefix=FROM=TOcommand line flag, by offering a profile setting namedtrim-pathsin Cargo to sanitize absolute paths introduced during compilation that may be embedded in the compiled binary executable or library.As part of that RFC the compiler was asked to add the
--remap-path-scopecommand-line flag to control the scoping of how paths get remapped in the resulting binary.Tracking:
What is stabilized
The rustc
--remap-path-scopeflag is being stabilized by this PR. It defines which scopes of paths should be remapped by--remap-path-prefix.This flag accepts a comma-separated list of values and may be specified multiple times, in which case the scopes are aggregated together.
The valid scopes are:
macro- apply remappings to the expansion ofstd::file!()macro. This is where paths in embedded panic messages come fromdiagnostics- apply remappings to printed compiler diagnosticsdebuginfo- apply remappings to debug informationscoverage- apply remappings to coverage informationsobject- apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias formacro,coverage,debuginfo.all(default) - an alias for all of the above, also equivalent to supplying only--remap-path-prefixwithout--remap-path-scope.Example
What isn't stabilized
None of the Cargo facility is being stabilized in this stabilization PR, only the
--remap-path-scopeflag inrustcis being stabilized.Design
RFC history
Answers to unresolved questions
There are no unresolved questions regarding
--remap-path-scope.(The tracking issue list a bunch of unresolved questions but they are for
--remap-path-prefixor the bigger picturetrim-pathsin Cargo and are not related the functionality provided by--remap-path-scope.)Post-RFC changes
The RFC described more scopes, in particularly regarding split debuginfo. Those scopes where removed after analysis by
michaelwoeristerof all the possible combinations in #111540 (comment).Nightly extensions
There are no nightly extensions.
Doors closed
We are committing to having to having a flag that control which paths are being remapped based on a "scope".
Feedback
Call for testing
No call for testing has been done per se but feedback has been received on both the rust-lang/rust and rust-lang/cargo tracking issue.
The feedback was mainly related to deficiencies in our best-effort
--remap-path-prefiximplementation, in particular regarding linkers added paths, which does not change anything for--remap-path-scope.Nightly use
Except for Cargo unstable
trim-pathsthere doesn't appear any committed use on GitHub.Implementation
Major parts
rust/compiler/rustc_session/src/config.rs
Lines 1373 to 1384 in b3f8586
rust/compiler/rustc_session/src/session.rs
Line 1526 in b3f8586
rust/compiler/rustc_span/src/lib.rs
Lines 352 to 372 in b3f8586
Coverage
tests/run-make/split-debuginfo/rmake.rstests/ui/errors/remap-path-prefix.rstests/ui/errors/remap-path-prefix-macro.rstests/run-make/remap-path-prefix-dwarf/rmake.rstests/run-make/remap-path-prefix/rmake.rstests/ui/errors/remap-path-prefix-diagnostics.rsOutstanding bugs
There are no outstanding bugs regarding
--remap-path-scope.Outstanding FIXMEs
There are no FIXME regarding
--remap-path-scopein it-self.Tool changes
rustdochas support for--remap-path-prefix, it should probably also get support for--remap-path-scope, although rustdoc maybe want to adapt the scopes for it's use (replacedebuginfowithdocumentationfor example).History
-Zremap-path-scopermeta handling #139550-Zremap-path-scopetests with dependency #140716Acknowledgments
@rustbot labels +T-compiler +needs-fcp +F-trim-paths
r? @davidtwco