Skip to content

Commit 9ba6812

Browse files
committed
Add some more comments on add_error_format.
1 parent 342f860 commit 9ba6812

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,24 @@ fn add_color(bcx: &BuildContext<'_, '_>, cmd: &mut ProcessBuilder) {
719719
cmd.args(&["--color", color]);
720720
}
721721

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.
722740
fn add_error_format(
723741
cx: &Context<'_, '_>,
724742
cmd: &mut ProcessBuilder,

0 commit comments

Comments
 (0)