diff options
| author | Michael Woerister <michaelwoerister@posteo.net> | 2017-03-14 15:50:40 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo.net> | 2017-03-22 17:02:07 +0100 |
| commit | bc259ee844f608599293c83d96de353005681cca (patch) | |
| tree | b2bfc622dd14072f227b8e7f8c56567d594c263d /src/libsyntax | |
| parent | 559127b4517229115397404f20167bc7b702d3d6 (diff) | |
| download | rust-bc259ee844f608599293c83d96de353005681cca.tar.gz rust-bc259ee844f608599293c83d96de353005681cca.zip | |
Introduce HirId, a replacement for NodeId after lowering to HIR.
HirId has a more stable representation than NodeId, meaning that modifications to one item don't influence (part of) the IDs within other items. The other part is a DefIndex for which there already is a way of stable hashing and persistence. This commit introduces the HirId type and generates a HirId for every NodeId during HIR lowering, but the resulting values are not yet used anywhere, except in consistency checks.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/placeholders.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index f60b1d17a5e..f0e328a551d 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -178,17 +178,9 @@ impl<'a, 'b> Folder for PlaceholderExpander<'a, 'b> { block.stmts = block.stmts.move_flat_map(|mut stmt| { remaining_stmts -= 1; - match stmt.node { - // Avoid wasting a node id on a trailing expression statement, - // which shares a HIR node with the expression itself. - ast::StmtKind::Expr(ref expr) if remaining_stmts == 0 => stmt.id = expr.id, - - _ if self.monotonic => { - assert_eq!(stmt.id, ast::DUMMY_NODE_ID); - stmt.id = self.cx.resolver.next_node_id(); - } - - _ => {} + if self.monotonic { + assert_eq!(stmt.id, ast::DUMMY_NODE_ID); + stmt.id = self.cx.resolver.next_node_id(); } Some(stmt) |
