1
Fork 0

rustc_span: More consistent span combination operations

This commit is contained in:
Vadim Petrochenkov 2024-01-05 17:30:14 +03:00
parent fb1cca2937
commit 508d1ff7d8
3 changed files with 50 additions and 52 deletions

View file

@ -2489,7 +2489,7 @@ impl<'a> Parser<'a> {
}
ExprKind::Block(_, None) => {
this.dcx().emit_err(errors::IfExpressionMissingCondition {
if_span: lo.shrink_to_hi(),
if_span: lo.with_neighbor(cond.span).shrink_to_hi(),
block_span: self.sess.source_map().start_point(cond_span),
});
std::mem::replace(&mut cond, this.mk_expr_err(cond_span.shrink_to_hi()))