Skip to content

Print out the output line that fails json parsing #33392

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/tools/compiletest/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ fn parse_line(file_name: &str, line: &str) -> Vec<Error> {
expected_errors
}
Err(error) => {
panic!("failed to decode compiler output as json: `{}`", error);
panic!("failed to decode compiler output as json: `{}` when parsing: {}", error,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think I agree with @alexcrichton, seems like we should pass in output and -- in the event of error -- print both the entire output and the failed line. It might be better still to pass in more context (such as stderr etc) -- basically the ProcRes struct, I think it's called? Then we can just call fatal_proc_res which dumps a lot of context iirc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(when these errors crop up on a bot, the more context the better)

line);
}
}
} else {
Expand Down