- Notifications
You must be signed in to change notification settings - Fork 13.8k
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-paths
there 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-scope
is 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
.
ac9448d
to bcbf54a
Compare Currently the (Historically I believe they were under Tools like
|
Stabilization report of
--remap-path-scope
Summary
RFC 3127 trim-paths aims to improve the current status of sanitizing paths emitted by the compiler via the
--remap-path-prefix=FROM=TO
command line flag, by offering a profile setting namedtrim-paths
in 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-scope
command-line flag to control the scoping of how paths get remapped in the resulting binary.Tracking:
What is stabilized
The rustc
--remap-path-scope
flag 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 informationsobject
- apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias formacro,debuginfo
.all
(default) - an alias for all of the above, also equivalent to supplying only--remap-path-prefix
without--remap-path-scope
.Example
What isn't stabilized
None of the Cargo facility is being stabilized in this stabilization PR, only the
--remap-path-scope
flag inrustc
is 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-prefix
or the bigger picturetrim-paths
in 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
michaelwoerister
of 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-prefix
implementation, in particular regarding linkers added paths, which does not change anything for--remap-path-scope
.Nightly use
Except for Cargo unstable
trim-paths
there 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.rs
tests/ui/errors/remap-path-prefix.rs
tests/ui/errors/remap-path-prefix-macro.rs
tests/run-make/remap-path-prefix-dwarf/rmake.rs
tests/run-make/remap-path-prefix/rmake.rs
tests/ui/errors/remap-path-prefix-diagnostics.rs
Outstanding bugs
There are no outstanding bugs regarding
--remap-path-scope
.Outstanding FIXMEs
There are no FIXME regarding
--remap-path-scope
in it-self.Tool changes
rustdoc
has 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 (replacedebuginfo
withdocumentation
for example).History
-Zremap-path-scope
rmeta handling #139550-Zremap-path-scope
tests with dependency #140716Acknowledgments
@rustbot labels +T-compiler +needs-fcp +F-trim-paths
r? @davidtwco