Skip to content

Commit

Permalink
Don't ICE on dummy spans (rustc uses 0 for dummy values, we use usi…
Browse files Browse the repository at this point in the history
…ze::MAX)
  • Loading branch information
oli-obk committed May 1, 2024
1 parent e0c0664 commit f9c13d1
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 f9c13d1

Please sign in to comment.