Skip to content

Add flag to modify the working directory assumed by the diagnostics #88754

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Manishearth opened this issue Sep 8, 2021 · 4 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-reproducibility Area: Reproducible / deterministic builds C-feature-request Category: A feature request, i.e: not implemented / a PR. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Manishearth
Copy link
Member

Manishearth commented Sep 8, 2021

See rust-lang/cargo#9887

Currently rustc prints diagnostics relative to the current working directory of its invocation. However, cargo has a habit of switching the CWD to the workspace root before invoking rustc, which means that the user's CWD ends up being something different.

It would be nice to have a flag (--diagnostic-cwd?) that lets you specify a path relative to which all diagnostics should be printed.

@Manishearth Manishearth added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 8, 2021
@camelid
Copy link
Member

camelid commented Sep 8, 2021

I wonder if --remap-path-prefix could be helpful for this?

@Manishearth
Copy link
Member Author

Existing discussions: #73740 #87745

@Manishearth
Copy link
Member Author

@camelid No, because that impacts the binary, and that would mean that cargo build would have to rebuild the crate every time you cd to a different folder in the workspace

@jieyouxu jieyouxu added A-reproducibility Area: Reproducible / deterministic builds D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Aug 14, 2024
@Urgau
Copy link
Member

Urgau commented Aug 21, 2024

We now have --remap-path-scope from trim-paths RFC 3127 that applies scopes to the remap path prefixes such as --remap-path-scope=diagnostics which applies the remapping only for the diagnostics.

Closing in favour of the tracking issue.

@Urgau Urgau closed this as completed Aug 21, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-reproducibility Area: Reproducible / deterministic builds C-feature-request Category: A feature request, i.e: not implemented / a PR. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants