Skip to content

Commit 231bd48

Browse files
authored
Rollup merge of #59677 - phansch:rustfix_coverage_handle_other_error_formats, r=oli-obk
rustfix coverage: Skip UI tests with non-json error-format When using the `rustfix-coverage` flag, some tests currently fail because they define a different error-format than `json`. The current implementation crashes when encountering those tests. Since we don't care about non-json test output when collecting the coverage data, we handle those tests by returning an empty `Vec` instead. r? @oli-obk
2 parents eb3215e + da99f46 commit 231bd48

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/tools/compiletest/src/runtest.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2820,12 +2820,15 @@ impl<'test> TestCx<'test> {
28202820
// don't test rustfix with nll right now
28212821
} else if self.config.rustfix_coverage {
28222822
// Find out which tests have `MachineApplicable` suggestions but are missing
2823-
// `run-rustfix` or `run-rustfix-only-machine-applicable` headers
2823+
// `run-rustfix` or `run-rustfix-only-machine-applicable` headers.
2824+
//
2825+
// This will return an empty `Vec` in case the executed test file has a
2826+
// `compile-flags: --error-format=xxxx` header with a value other than `json`.
28242827
let suggestions = get_suggestions_from_json(
28252828
&proc_res.stderr,
28262829
&HashSet::new(),
28272830
Filter::MachineApplicableOnly
2828-
).unwrap();
2831+
).unwrap_or_default();
28292832
if suggestions.len() > 0
28302833
&& !self.props.run_rustfix
28312834
&& !self.props.rustfix_only_machine_applicable {

0 commit comments

Comments
 (0)