-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking issue for unstable --json-rendered
flag
#60987
Comments
I'd like to propose that this feature is stabilized in an effort to stabilize pipelined compilation. As a brief summary of how this flag works today, when passed to the compiler the I would propose the following stabilization:
This should be sufficient for all of Cargo's usage, and we'd mirror the option into |
Oh and cc @rust-lang/compiler, could I persuade one of y'all to kick of FCP for stabilization? I wrote a summary above for what I'm proposing to be stabilized here. |
I feel like we're accumulating a bunch of flags that are related but not explicitly grouped (like |
Instead of having a a non-color flag and a color flag for each variant we can also reuse the |
Would it be possible to have an option to include all rendering styles in the case where it is being cached and we don't know how its going to be used or consumed? Is color vs. non-color just a matter of stripping out ctrl characters? |
@jsgf With the ANSI output, you'd need to have a small parser to find where the escape sequence stops (i.e. it always starts with a |
@eddyb Cargo already implements ansi parsing and stripping when necessary. It uses the |
I'm a little concerned about stabilizing this without having a strategy for supporting the caching use case. It needs a single JSON format that can be converted to all other output formats. Currently it works for everything except
ping @rust-lang/wg-diagnostics. I'm curious what the feasibility of 2 is. Is it on the table as an option? Is it something that can happen within a year? I also think it's a little strange to have separate color controls from the |
@ehuss Yes, that's exactly my concern - I'd like to cache the json output and be able to generate any of the other forms on demand, without having separate implementation of diagnostics rendering. |
@rust-lang/wg-diagnostics is working on integrating the We could even extend So it definitely is doable, but we have our hands full with just using |
@jsgf and @ehuss can y'all explain more why you think that a diagnostic JSON message should contain all possible renderings? I understand the idea of wanting it cached, but why would you want it cached and dynamically switched between builds? This seems like a setting that is rarely flipped and wouldn't really benefit from an A+ user-experience of caching as much as possible. I would personally be fine interpreting To that end could I propose that we simply stabilize the intent of interpreting |
There are some use cases where switching outputs is common. For example, my editor uses JSON, whereas when I run cargo manually in a terminal it uses human output. It would be bad if the cached output spit JSON into the terminal. The cache implementation in cargo handles this, except for the "short" case. It would be weird if you asked for "short" output and suddenly got the verbose human output, or vice-versa. That being said, I wonder how often the short output is used. I suspect it is extremely rare, in which case perhaps leaving it a little broken might be ok. Thinking about it more, I think my concern can be addressed later and independently. Such as making One nitpick about naming, perhaps use Also, making it use the |
Ah ok I think I see what you mean as well with caching and stale messages. It's a good point as well with |
In our environment, Buck caches are very persistent and shared among multiple users. A cache entry could have been generated by CI, and then reused as part of a user's manually invoked build, or in a rustfix-style linter build. In other words, the original cached form must be reusable for all these other use-cases. |
@jsgrf I'm curious, does Buck normally cache the console output from compilers, or is this something unique for the rust integration? |
@ehuss It doesn't at present, but it's something I'd like to add. I've been writing tooling to auto-apply fix suggestions in error messages, and its very annoying to have to deliberately break caching in order to get diagnostics. Also it falls out of distributed builds (Remote Execution) pretty naturally, because all the output artifacts are transferred via a content store, including diagnostics. |
FWIW, this use case is the exact reason I wrote the |
Ok in an attempt to prod this again, I'd like to propose that this feature is stabilized in an effort to stabilize pipelined compilation. Given the discussion here I would propose a different stabilization path than the one I mentioned above, namely:
That should be all that's necessary for Cargo (and this would be mirrored in |
@rfcbot fcp merge I am going to propose that we stabilize @alexcrichton's proposal, where
We are going however to need:
|
Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@rfcbot fcp cancel On second though, I'm going to cancel this proposal because I feel like it is mildly backwards incompatible, since |
@nikomatsakis proposal cancelled. |
@rfcbot fcp merge Instead I am going to propose the we stabilize @alexcrichton's original proposal. Key points:
There was a short discussion on Zulip between @oli-obk and @Zoxc and I in which we discuss a few mild variations. I would be happy with any of these but I'm going to propose that we go forward with what we have today in the interests of expediency, and because all of these changes seem "backwards compatible" or just not especially important. Still, I think if somebody opened a PR for one of the changes below, we could accept that and still stabilize.
|
Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
(I tagged @michaelwoerister while they're on PTO) |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
While we're waiting for FCP to finish, I've proposed an implementation of this stabilization at #62766 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
This commit stabilizes options in the compiler necessary for Cargo to enable "pipelined compilation" by default. The concept of pipelined compilation, how it's implemented, and what it means for rustc are documented in rust-lang#60988. This PR is coupled with a PR against Cargo (rust-lang/cargo#7143) which updates Cargo's support for pipelined compliation to rustc, and also enables support by default in Cargo. (note that the Cargo PR cannot land until this one against rustc lands). The technical changes performed here were to stabilize the functionality proposed in rust-lang#60419 and rust-lang#60987, the underlying pieces to enable pipelined compilation support in Cargo. The issues have had some discussion during stabilization, but the newly stabilized surface area here is: * A new `--json` flag was added to the compiler. * The `--json` flag can be passed multiple times. * The value of the `--json` flag is a comma-separated list of directives. * The `--json` flag cannot be combined with `--color` * The `--json` flag must be combined with `--error-format=json` * The acceptable list of directives to `--json` are: * `diagnostic-short` - the `rendered` field of diagnostics will have a "short" rendering matching `--error-format=short` * `diagnostic-rendered-ansi` - the `rendered` field of diagnostics will be colorized with ansi color codes embedded in the string field * `artifacts` - JSON blobs will be emitted for artifacts being emitted by the compiler The unstable `-Z emit-artifact-notifications` and `--json-rendered` flags have also been removed during this commit as well. Closes rust-lang#60419 Closes rust-lang#60987 Closes rust-lang#60988
…r=oli-obk rustc: Stabilize options for pipelined compilation This commit stabilizes options in the compiler necessary for Cargo to enable "pipelined compilation" by default. The concept of pipelined compilation, how it's implemented, and what it means for rustc are documented in #60988. This PR is coupled with a PR against Cargo (rust-lang/cargo#7143) which updates Cargo's support for pipelined compliation to rustc, and also enables support by default in Cargo. (note that the Cargo PR cannot land until this one against rustc lands). The technical changes performed here were to stabilize the functionality proposed in #60419 and #60987, the underlying pieces to enable pipelined compilation support in Cargo. The issues have had some discussion during stabilization, but the newly stabilized surface area here is: * A new `--json` flag was added to the compiler. * The `--json` flag can be passed multiple times. * The value of the `--json` flag is a comma-separated list of directives. * The `--json` flag cannot be combined with `--color` * The `--json` flag must be combined with `--error-format=json` * The acceptable list of directives to `--json` are: * `diagnostic-short` - the `rendered` field of diagnostics will have a "short" rendering matching `--error-format=short` * `diagnostic-rendered-ansi` - the `rendered` field of diagnostics will be colorized with ansi color codes embedded in the string field * `artifacts` - JSON blobs will be emitted for artifacts being emitted by the compiler The unstable `-Z emit-artifact-notifications` and `--json-rendered` flags have also been removed during this commit as well. Closes #60419 Closes #60987 Closes #60988
This issue is intended to be a tracking issue for the
--json-rendered
flag implemented in #59128. The--json-rendered
flag can either takeplain
ortermcolor
, and affects whether ANSI color codes are embedded into therendered
field of JSON diagnostics.Known issues with this:
Future features:
rendered
field of json diagnostics #59128 (comment))--error-format=short
)cc @oli-obk, original author of the feature
The text was updated successfully, but these errors were encountered: