-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Conversation
99b9ca6
to
8bc04a8
Compare
8bc04a8
to
b919e47
Compare
I have a separate commit awaiting for this and #45752 to be merged to make the output configurable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts:
- I don't see any tests here.
- 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.)
- (For example, we might require
- 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).
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? |
There's an old PR for a similar feature (that was closed) as well |
I was hoping for something even more powerful, like |
I would think that we would want to put more complex configuration into some form of file, no? |
@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. |
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. |
@estebank what do you think about landing this as is but with some kind of |
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. |
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. |
I'll draft up an RFC over the weekend. |
It works pretty well to have multiple teams on an RFC, so dev-tools + compiler seems good |
@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. |
Close it in my personal opinion.
…On Jan 19, 2018 6:39 PM, "Niko Matsakis" ***@***.***> wrote:
@estebank <https://github.com/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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#46961 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AhXLZtb93khPXnFnFmuJmZccgTXJT-36ks5tMSfEgaJpZM4RLiqv>
.
|
Closing it in favor of gating on |
RUSTC_COLOR
.RUSTC_ERROR_FORMAT
.r? @nikomatsakis