Give ast::ExprKind::Paren no-op expressions the same ids as their children.#34355
Conversation
This does not sound like a guarantee we want to maintain. |
|
@arielb1 |
|
We are planning to do a major refactoring of |
|
@arielb1 ok, I believe I'm still not sure which ast nodes besides |
|
@bors: r+ |
|
📌 Commit 24a3a26 has been approved by |
|
⌛ Testing commit 24a3a26 with merge ad3e6e6... |
|
💔 Test failed - auto-linux-64-opt |
24a3a26 to
8557a2e
Compare
|
@bors r=nrc |
|
📌 Commit 8557a2e has been approved by |
…nique, r=nrc Give `ast::ExprKind::Paren` no-op expressions the same ids as their children. Having `ast::ExprKind::Paren` expressions share ids with their children - reduces the number of unused `NodeId`s in the hir map and - guarantees that `tcx.map.expect_expr(ast_expr.id)` is the hir corresponding to `ast_expr`. This fixes the bug from rust-lang#34327, which was introduced in rust-lang#33296 when I assumed the above guarantee. r? @nrc
The special case breaks several useful invariants (`ExpnId`s are globally unique, and never change). This special case was added back in 2016 in rust-lang#34355
…rochenkov 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 rust-lang#34355 r? `@petrochenkov`
Having
ast::ExprKind::Parenexpressions share ids with their childrenNodeIds in the hir map andtcx.map.expect_expr(ast_expr.id)is the hir corresponding toast_expr.This fixes the bug from #34327, which was introduced in #33296 when I assumed the above guarantee.
r? @nrc