rustc_parse: correct span on range expr with attrs

This commit is contained in:
Caleb Cartwright 2020-10-12 12:24:24 -05:00
parent 7280f6aa41
commit 4e82da4a48

View File

@ -406,7 +406,7 @@ impl<'a> Parser<'a> {
None
};
let rhs_span = rhs.as_ref().map_or(cur_op_span, |x| x.span);
let span = lhs.span.to(rhs_span);
let span = self.mk_expr_sp(&lhs, lhs.span, rhs_span);
let limits =
if op == AssocOp::DotDot { RangeLimits::HalfOpen } else { RangeLimits::Closed };
Ok(self.mk_expr(span, self.mk_range(Some(lhs), rhs, limits)?, AttrVec::new()))