-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Remap paths from other crates #117836
Remap paths from other crates #117836
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
@Nemo157 suggested that remapping should be cumulative, instead of giving precedence to the first flag. In other words, if a file is at path |
Previously, `remap-path-prefix` only applied to files loaded *in the current session*. File names loaded in a previous invocation were used unchanged. This is unfortunate for UI testing when some of the crates involved are in the standard library (we don't want to recompile the standard library for arbitrary tests). Change it to apply to existing files as well. I believe this will eventually allow removing the special-casing for `-Z simulate-remapped-rust-src-base`.
It was never used, and it's ambiguous what the answer should be for paths that were remapped in a previous session.
60be925
to
844b157
Compare
How do this interact with |
@Urgau it should work fine, remap-path-scope works by taking an existing |
Is there anybody familiar with this topic besides michaelwoerister, who is unavailable? I only remember that path remapping has seen numerous changes and fixes in rustc and multiple RFCs, and it was never enough. |
The changes look reasonable to me, but I'm not sure what are the full implications. I'm going to ping @rust-lang/compiler, then wait for a week, then r+. |
This has been brought up before:
I don't have an opinion either way, but if we were to introduce it, it should be a deliberate change through MCP. It shouldn't be introduced in this PR. |
I think this came up a few times before and I vaguely remember it being more complicated than one would think. I'll add myself as a reviewer and will try to remember what the complications were. |
As far as I can tell, the main reason the remapping is only applied to the current crate is that remapped paths are emitted into compiled artifacts (e.g. panic messages in object files, debuginfo, etc) and subsequent compilation sessions cannot modify those anymore. The effect being that one gets an unpredictable mix of paths in the final output. For example, if there's a crate A containing an From my point of view that is a blocker for recursive remapping. Making Cargo do the heavy lifting as described in the trim paths RFC seems like the better approach to me. |
@jyn514 any updates on this? thanks |
nope |
Previously,
remap-path-prefix
only applied to files loaded in the current session. File namesloaded in a previous invocation were used unchanged. This is unfortunate for UI testing when some of
the crates involved are in the standard library (we don't want to recompile the standard library for
arbitrary tests).
Change it to apply to existing files as well. I believe this will eventually allow removing the
special-casing for
-Z simulate-remapped-rust-src-base
. I'm willing to make that change here if desired.Fixes #66251. This might allow me to unblock #117609 without first waiting for #113611 to land (need to test).