Skip to content

Commit 3f4da0d

Browse files
committed
Use inner span ctxt when lowering paren
The need for this arose when encountering range expressions surrounded by parenthesis, where we want the span desugaring mark to be preserved.
1 parent 19abae7 commit 3f4da0d

File tree

1 file changed

+1
-1
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+1
-1
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
6868
let mut ex = self.lower_expr_mut(ex);
6969
// Include parens in span, but only if it is a super-span.
7070
if e.span.contains(ex.span) {
71-
ex.span = self.lower_span(e.span);
71+
ex.span = self.lower_span(e.span.with_ctxt(ex.span.ctxt()));
7272
}
7373
// Merge attributes into the inner expression.
7474
if !e.attrs.is_empty() {

0 commit comments

Comments
 (0)