-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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-path-prefix
does not apply to secondary files in diagnostics
#66251
Comments
Using https://github.com/jebrosen/rust-lang-66251 (the initial commit here) as a smaller reproduction example:
This only occurs when the secondary file is not in the current crate, and certain operations (e.g. renaming directories) cause the secondary file to not be shown at all until a |
I think this may be a duplicate of #66955. |
I don't think that is related; I can reproduce the same behavior from my previous comment on the latest nightly, including renaming a directory making the second part of the diagnostic disappear. Out of curiosity I tried setting it in
I have no idea how |
I ran into this today (also while writing a UI test, funnily enough: #117609). The problem is that
|
rust/compiler/rustc_span/src/source_map.rs Lines 209 to 211 in f405ce8
filename is ignored if there's already a SourceFile registered: rust/compiler/rustc_span/src/source_map.rs Lines 323 to 327 in f405ce8
@michaelwoerister how do you expect this to behave if --remap-path-prefix was passed to only some of the crates? |
I don't know why it makes part of the warning disappear. I could imagine that's because the file referred does not actually exist on disk (because the path is remapped), and the compiler fails while trying to construct the text of the warning snippet. However, that issue seems to have been fixed for current compiler versions:
|
As mentioned in #117836, each crate only gets a single chance of remapping its paths because some of artifacts produced cannot be changed once the crate has been compiled. |
A special case here is paths in sysroot crates (
That is, despite these paths being imported from another crate, due to the |
Since #64151 added some new diagnostics, Rocket's UI tests have had mismatches in stderr that I can't seem to fix. In particular these diagnostics include "secondary file" paths that aren't easily normalizable or remappable.
I haven't tried to make a minimal reproduction yet, but this output should illustrate the problem:
Here I'm remapping
tests/ui-fail
tofoo
to demonstrate that--remap-path-prefix
works at all. Remapping/home/jeb/code/Rocket
to/Rocket
is the real goal, because if I can get that to work we should have errors that are identical across build environments. However, it is not actually remapped in the output. Is--remap-path-prefix
intended to apply to these?My first attempt at this was to update compiletest to normalize
$SRC_DIR
(Manishearth/compiletest-rs#198), but that has some problems that I think the--remap-path-prefix
approach would neatly avoid.Meta
rustc --version --verbose
:rustc 1.40.0-nightly (1423bec 2019-11-05)
binary: rustc
commit-hash: 1423bec
commit-date: 2019-11-05
host: x86_64-unknown-linux-gnu
release: 1.40.0-nightly
LLVM version: 9.0
The text was updated successfully, but these errors were encountered: