Skip to content

Add env flags RUSTC_COLOR and RUSTC_ERROR_FORMAT #46961

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

Closed
wants to merge 1 commit into from

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Dec 23, 2017

  • Rework flag RUSTC_COLOR.
  • Add flag RUSTC_ERROR_FORMAT.

r? @nikomatsakis

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 23, 2017
@estebank
Copy link
Contributor Author

estebank commented Jan 3, 2018

I have a separate commit awaiting for this and #45752 to be merged to make the output configurable:

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts:

  1. I don't see any tests here.
  2. Can we feature-gate this?
    • (For example, we might require -Z custom-color or something before we check for the presence of the environment variable.)
  3. I think we want to have an RFC here. It feels like the choice of environment variables and their legal values ought to be more widely discussed (and advertised).

@nikomatsakis
Copy link
Contributor

cc @rust-lang/compiler @rust-lang/dev-tools

This PR modifies the compiler to consider various environment variables and tweak its output accordingly (for example, permitting "shorter" or "longer" output, or more or less colors). Such a step may be inevitable, though I think we should endeavor not to wind up supporting too many options.

It seems like something we ought to discuss in an RFC -- perhaps a dev-tools RFC? I'm not really sure who "controls" the compiler's command-line interface, it's kind of a grey area.

There is also a sort of backwards compatibility aspect here: examining an environment variable we previously ignored could break people's tooling. Do we care about this?

@alexcrichton
Copy link
Member

There's an old PR for a similar feature (that was closed) as well

@GuillaumeGomez
Copy link
Member

I was hoping for something even more powerful, like LS_COLORS (to change output colors through an environment variable). I'm not sure this is such a good idea to pass this option as an environment variable as well...

@nikomatsakis
Copy link
Contributor

I would think that we would want to put more complex configuration into some form of file, no?

@estebank
Copy link
Contributor Author

estebank commented Jan 5, 2018

@nikomatsakis @GuillaumeGomez That was my original thinking, adding a configuration file that could have as many flags as possible so that anyone could fine tweak the diagnostic output to their liking, but getting serde to work in rustc means foregoing serde_derive, which makes it slightly more annoying than I'd like.

@nikomatsakis
Copy link
Contributor

@estebank

Argh, that is frustrating.

Of course, in the limit, we could write some custom code for parsing the particular TOML that the compiler wants (which would presumably be very simple -- at least for now).

Alternatively, we could perhaps run a "pre-process" step to generate the glue (and check it in).

All suboptimal, of course, but it would offer us a way forward. We ought to look at how to support serde-derive though.

@nikomatsakis
Copy link
Contributor

@estebank what do you think about landing this as is but with some kind of -Z flag required, just for now? I'd like to make progress on the color etc.

@nrc
Copy link
Member

nrc commented Jan 12, 2018

I'm not sure whether I prefer a file or env vars - the latter is certainly easier for tools which call rustc. I guess I don't really know what the use cases are here, and in that context I think an RFC, or maybe an internals thread making a plan for the error display evolution would be good.

@nikomatsakis
Copy link
Contributor

I think I agree with the idea of an RFC -- what team do you think ought to make the final decision? Sometimes I feel like we need a "compiler UI" team that is focused on error display and formatting.

@estebank
Copy link
Contributor Author

I'll draft up an RFC over the weekend.

@nrc
Copy link
Member

nrc commented Jan 14, 2018

what team do you think ought to make the final decision?

It works pretty well to have multiple teams on an RFC, so dev-tools + compiler seems good

@kennytm kennytm added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Jan 17, 2018
@nikomatsakis
Copy link
Contributor

@estebank my review queue is ridiculous and I'd like to clear it out some. Do you think we can either land this gated (pending an RFC) or else close it? I'm good with either one, really.

@BubbaSheen
Copy link

BubbaSheen commented Jan 19, 2018 via email

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2018
@estebank
Copy link
Contributor Author

Closing it in favor of gating on -Zteach.

@estebank estebank closed this Jan 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants