Skip to content

Commit

Permalink
Merge pull request #223 from oli-obk/nonzer
Browse files Browse the repository at this point in the history
Don't ICE on dummy spans (rustc uses `0` for dummy values, we use usize::MAX)
  • Loading branch information
oli-obk authored May 1, 2024
2 parents e77e554 + f9c13d1 commit 4bfbbb8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/rustc_stderr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ fn span_line(span: &DiagnosticSpan, file: &Path, primary: bool) -> Option<spanne
};
}
}
((!primary || span.is_primary) && file_name == file).then_some(spanned::Span {
file: file_name,
line_start: span.line_start.try_into().unwrap(),
line_end: span.line_end.try_into().unwrap(),
col_start: span.column_start.try_into().unwrap(),
col_end: span.column_end.try_into().unwrap(),
((!primary || span.is_primary) && file_name == file).then(|| {
let span = || {
Some(spanned::Span {
file: file_name,
line_start: span.line_start.try_into().ok()?,
line_end: span.line_end.try_into().ok()?,
col_start: span.column_start.try_into().ok()?,
col_end: span.column_end.try_into().ok()?,
})
};
span().unwrap_or_default()
})
}

Expand Down

0 comments on commit 4bfbbb8

Please sign in to comment.