Skip to content

Commit 9851a29

Browse files
committed
Add the span of attributes of the lhs to the span of the assignment expression
1 parent ec7ecb3 commit 9851a29

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libsyntax/parse/parser.rs

+8
Original file line numberDiff line numberDiff line change
@@ -3455,6 +3455,14 @@ impl<'a> Parser<'a> {
34553455
}),
34563456
}?;
34573457

3458+
// Make sure that the span of the parent node is larger than the span of lhs and rhs,
3459+
// including the attributes.
3460+
let lhs_span = lhs
3461+
.attrs
3462+
.iter()
3463+
.filter(|a| a.style == AttrStyle::Outer)
3464+
.next()
3465+
.map_or(lhs_span, |a| a.span);
34583466
let span = lhs_span.to(rhs.span);
34593467
lhs = match op {
34603468
AssocOp::Add | AssocOp::Subtract | AssocOp::Multiply | AssocOp::Divide |

0 commit comments

Comments
 (0)