Description
Proposal
rustc should offer a way for users to request absolute paths in its diagnostic output as an opt-in (e.g. env var and/or command line flag, e.g. --error-format=human,absolute-paths
)
We know from experience (rust-lang/rust#47355, rust-lang/rust#47669, rust-lang/rust#128726, rust-lang/cargo#4998, rust-lang/cargo#9887) that some tools have difficulty dealing with the relative paths that rustc emits.
(This problem was somewhat exacerbated by rust-lang/cargo#4788; there were some changes make in the wake of that PR that addressed some of the problems above, but not all of them.)
There is general interest on the cargo side to have some way to opt-into generation of absolute paths, see e.g.: rust-lang/cargo#5450
My suggestion is that we get the basic functionality here put into rustc.
In speaking with @estebank , they mentioned that there's a wealth of options here.
- E.g. the json diagnostic format could include both a relative path and an absolute path, and let the tool decide which one to present. I'm sure there's many options along those lines; I just want to get the ball rolling on having some way for the user to say "I want my diagnostics to use absolute paths, thank you."
- Also, there was some effort back in 2018 to try to give rustc a way to say "print your diagnostics relative to location X instead of what you think is the current working directory"; you can see discussion of that over on Add a compiler option for a 'pseudo-cwd' for rustc errors rust#47939, but the summary is that the work fizzled out because the team decided the feature was to hacky for us to adopt.
Mentors or Reviewers
@estebank is my current "obvious" choice for mentorship/review.
Process
The main points of the Major Change Process are as follows:
- File an issue describing the proposal.
- A compiler team member or contributor who is knowledgeable in the area can second by writing
@rustbot second
.- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
-C flag
, then full team check-off is required. - Compiler team members can initiate a check-off via
@rfcbot fcp merge
on either the MCP or the PR.
- Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a
- Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.
You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.