1
Fork 0

Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkov

Remove special case for `ExprKind::Paren` in `MutVisitor`

The special case breaks several useful invariants (`ExpnId`s are
globally unique, and never change). This special case
was added back in 2016 in https://github.com/rust-lang/rust/pull/34355

r? `@petrochenkov`
This commit is contained in:
bors 2021-07-19 23:50:23 +00:00
commit 6535449a00
3 changed files with 19 additions and 6 deletions

View file

@ -1347,12 +1347,6 @@ pub fn noop_visit_expr<T: MutVisitor>(
}
ExprKind::Paren(expr) => {
vis.visit_expr(expr);
// Nodes that are equal modulo `Paren` sugar no-ops should have the same IDs.
*id = expr.id;
vis.visit_span(span);
visit_thin_attrs(attrs, vis);
return;
}
ExprKind::Yield(expr) => {
visit_opt(expr, |expr| vis.visit_expr(expr));