@@ -719,6 +719,24 @@ fn add_color(bcx: &BuildContext<'_, '_>, cmd: &mut ProcessBuilder) {
719
719
cmd. args ( & [ "--color" , color] ) ;
720
720
}
721
721
722
+ /// Add error-format flags to the command.
723
+ ///
724
+ /// This is rather convoluted right now. The general overview is:
725
+ /// - If -Zcache-messages or `build.pipelining` is enabled, Cargo always uses
726
+ /// JSON output. This has several benefits, such as being easier to parse,
727
+ /// handles changing formats (for replaying cached messages), ensures
728
+ /// atomic output (so messages aren't interleaved), etc.
729
+ /// - `supports_termcolor` is a temporary flag. rustdoc does not yet support
730
+ /// the `--json-rendered` flag, but it is intended to fix that soon.
731
+ /// - `short` output is not yet supported for JSON output. We haven't yet
732
+ /// decided how this problem will be resolved. Probably either adding
733
+ /// "short" to the JSON output, or more ambitiously moving diagnostic
734
+ /// rendering to an external library that Cargo can share with rustc.
735
+ ///
736
+ /// It is intended in the future that Cargo *always* uses the JSON output, and
737
+ /// this function can be simplified. The above issues need to be resolved, the
738
+ /// flags need to be stabilized, and we need more testing to ensure there
739
+ /// aren't any regressions.
722
740
fn add_error_format (
723
741
cx : & Context < ' _ , ' _ > ,
724
742
cmd : & mut ProcessBuilder ,
0 commit comments