Skip to content

Commit 5606d1b

Browse files
committed
Rename show_warnings.
1 parent 13fef86 commit 5606d1b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/cargo/core/compiler/mod.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -1172,10 +1172,14 @@ struct OutputOptions {
11721172
/// of empty files are not created. If this is None, the output will not
11731173
/// be cached (such as when replaying cached messages).
11741174
cache_cell: Option<(PathBuf, LazyCell<File>)>,
1175-
/// If `true`, display any recorded warning messages.
1176-
/// Other types of messages are processed regardless
1177-
/// of the value of this flag
1178-
show_warnings: bool,
1175+
/// If `true`, display any diagnostics.
1176+
/// Other types of JSON messages are processed regardless
1177+
/// of the value of this flag.
1178+
///
1179+
/// This is used primarily for cache replay. If you build with `-vv`, the
1180+
/// cache will be filled with diagnostics from dependencies. When the
1181+
/// cache is replayed without `-vv`, we don't want to show them.
1182+
show_diagnostics: bool,
11791183
warnings_seen: usize,
11801184
errors_seen: usize,
11811185
}
@@ -1193,7 +1197,7 @@ impl OutputOptions {
11931197
look_for_metadata_directive,
11941198
color,
11951199
cache_cell,
1196-
show_warnings: true,
1200+
show_diagnostics: true,
11971201
warnings_seen: 0,
11981202
errors_seen: 0,
11991203
}
@@ -1319,7 +1323,7 @@ fn on_stderr_line_inner(
13191323
.map(|v| String::from_utf8(v).expect("utf8"))
13201324
.expect("strip should never fail")
13211325
};
1322-
if options.show_warnings {
1326+
if options.show_diagnostics {
13231327
count_diagnostic(&msg.level, options);
13241328
state.emit_diag(msg.level, rendered)?;
13251329
}
@@ -1404,7 +1408,7 @@ fn on_stderr_line_inner(
14041408
// from the compiler, so wrap it in an external Cargo JSON message
14051409
// indicating which package it came from and then emit it.
14061410

1407-
if !options.show_warnings {
1411+
if !options.show_diagnostics {
14081412
return Ok(true);
14091413
}
14101414

@@ -1438,15 +1442,15 @@ fn replay_output_cache(
14381442
path: PathBuf,
14391443
format: MessageFormat,
14401444
color: bool,
1441-
show_warnings: bool,
1445+
show_diagnostics: bool,
14421446
) -> Work {
14431447
let target = target.clone();
14441448
let mut options = OutputOptions {
14451449
format,
14461450
look_for_metadata_directive: true,
14471451
color,
14481452
cache_cell: None,
1449-
show_warnings,
1453+
show_diagnostics,
14501454
warnings_seen: 0,
14511455
errors_seen: 0,
14521456
};

0 commit comments

Comments
 (0)