Skip to content
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

Paths in save-analysis files are not remapped by --remap-path-prefix #52549

Closed
jsgf opened this issue Jul 19, 2018 · 1 comment
Closed

Paths in save-analysis files are not remapped by --remap-path-prefix #52549

jsgf opened this issue Jul 19, 2018 · 1 comment
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.

Comments

@jsgf
Copy link
Contributor

jsgf commented Jul 19, 2018

--remap-path-prefix is supposed to remap all references to paths in all output (error messages, debug info, etc). It looks like this isn't happening for save-analysis files.

For example, in current nightly: rustc 1.29.0-nightly (12ed235 2018-07-18)

This input

pub struct Foo;
rustc -Zsave-analysis -g --crate-type=rlib --emit=metadata t.rs --error-format json --remap-path-prefix=$(pwd)=.

produces a save-analysis file which still has references to my home dir:

        "external_crates": [
            {
                "file_name": "/Users/jsgf/t.rs",
                "id": {
                    "disambiguator": [
                        287500826263317014,
                        5864436369277545838
                    ],
                    "name": "std"
                },
                "num": 1
            },

Example in full output.

This is undesirable because it makes the output depend on the build directory, which breaks build artifact caching.

@jsgf
Copy link
Contributor Author

jsgf commented Jul 19, 2018

cc @nrc @Xanewok

@kennytm kennytm added A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. labels Jul 19, 2018
@nrc nrc added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jul 19, 2018
cramertj added a commit to cramertj/rust that referenced this issue Aug 8, 2018
…=nrc

Account for --remap-path-prefix in save-analysis

Fixes rust-lang#52549.

Didn't add a test since save-analysis is still unstable, only tested this locally. Should I add a test for that? If so, is run-make-fulldeps an appropriate format?

Session is already created with remapped working directory, so use that instead of the actual cwd.
This was the only place affected, since the rest of the paths in save-analysis are directly derived from files in spans from `sess.codemap()`, which already creates remapped ones.

r? @nrc
cramertj added a commit to cramertj/rust that referenced this issue Aug 8, 2018
…=nrc

Account for --remap-path-prefix in save-analysis

Fixes rust-lang#52549.

Didn't add a test since save-analysis is still unstable, only tested this locally. Should I add a test for that? If so, is run-make-fulldeps an appropriate format?

Session is already created with remapped working directory, so use that instead of the actual cwd.
This was the only place affected, since the rest of the paths in save-analysis are directly derived from files in spans from `sess.codemap()`, which already creates remapped ones.

r? @nrc
cramertj added a commit to cramertj/rust that referenced this issue Aug 8, 2018
…=nrc

Account for --remap-path-prefix in save-analysis

Fixes rust-lang#52549.

Didn't add a test since save-analysis is still unstable, only tested this locally. Should I add a test for that? If so, is run-make-fulldeps an appropriate format?

Session is already created with remapped working directory, so use that instead of the actual cwd.
This was the only place affected, since the rest of the paths in save-analysis are directly derived from files in spans from `sess.codemap()`, which already creates remapped ones.

r? @nrc
cramertj added a commit to cramertj/rust that referenced this issue Aug 8, 2018
…=nrc

Account for --remap-path-prefix in save-analysis

Fixes rust-lang#52549.

Didn't add a test since save-analysis is still unstable, only tested this locally. Should I add a test for that? If so, is run-make-fulldeps an appropriate format?

Session is already created with remapped working directory, so use that instead of the actual cwd.
This was the only place affected, since the rest of the paths in save-analysis are directly derived from files in spans from `sess.codemap()`, which already creates remapped ones.

r? @nrc
kennytm added a commit to kennytm/rust that referenced this issue Aug 9, 2018
…=nrc

Account for --remap-path-prefix in save-analysis

Fixes rust-lang#52549.

Didn't add a test since save-analysis is still unstable, only tested this locally. Should I add a test for that? If so, is run-make-fulldeps an appropriate format?

Session is already created with remapped working directory, so use that instead of the actual cwd.
This was the only place affected, since the rest of the paths in save-analysis are directly derived from files in spans from `sess.codemap()`, which already creates remapped ones.

r? @nrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants