From: Caleb Cartwright Date: Mon, 12 Oct 2020 17:24:24 +0000 (-0500) Subject: rustc_parse: correct span on range expr with attrs X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=4e82da4a48d4cf86521608c6f1cf137a5765910b;p=rust.git rustc_parse: correct span on range expr with attrs --- diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 649a86f219d..d0dfca73485 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -406,7 +406,7 @@ fn parse_range_expr( 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()))