Skip to content

Commit a6949e7

Browse files
committed
Avoid a long standing bug that was only now surfaced
1 parent 4ca90a8 commit a6949e7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/rustc_stderr.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub(crate) fn process(file: &Path, stderr: &[u8]) -> Diagnostics {
173173
let mut rendered = Vec::new();
174174
let mut messages = vec![];
175175
let mut messages_from_unknown_file_or_line = vec![];
176-
for (line_number, line) in stderr.lines_with_terminator().enumerate() {
176+
for line in stderr.lines_with_terminator() {
177177
if line.starts_with_str(b"{") {
178178
match serde_json::from_slice::<RustcMessage>(line) {
179179
Ok(msg) => {
@@ -187,11 +187,9 @@ pub(crate) fn process(file: &Path, stderr: &[u8]) -> Diagnostics {
187187
None,
188188
);
189189
}
190-
Err(err) => {
191-
panic!(
192-
"failed to parse rustc JSON output at line {line_number}: {err}: {}",
193-
line.to_str_lossy()
194-
)
190+
Err(_) => {
191+
// FIXME: add a way to swap out the `process` function, so that cargo can use a different one from rustc
192+
// The RustcMessage json just happens to match between the two
195193
}
196194
}
197195
} else {

0 commit comments

Comments
 (0)