Skip to content

Commit e95297c

Browse files
committed
Rollup merge of rust-lang#58528 - Zoxc:stmtkind-item, r=oli-obk
Don't use an allocation for ItemId in StmtKind
2 parents 897778e + cdd1c0e commit e95297c

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
953953
visitor.visit_id(statement.id);
954954
match statement.node {
955955
StmtKind::Local(ref local) => visitor.visit_local(local),
956-
StmtKind::Item(ref item) => visitor.visit_nested_item(**item),
956+
StmtKind::Item(item) => visitor.visit_nested_item(item),
957957
StmtKind::Expr(ref expression) |
958958
StmtKind::Semi(ref expression) => {
959959
visitor.visit_expr(expression)

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4656,7 +4656,7 @@ impl<'a> LoweringContext<'a> {
46564656
hir::Stmt {
46574657
id: node_id,
46584658
hir_id,
4659-
node: hir::StmtKind::Item(P(item_id)),
4659+
node: hir::StmtKind::Item(item_id),
46604660
span: s.span,
46614661
}
46624662
})
@@ -4686,7 +4686,7 @@ impl<'a> LoweringContext<'a> {
46864686
hir::Stmt {
46874687
id: node_id,
46884688
hir_id,
4689-
node: hir::StmtKind::Item(P(item_id)),
4689+
node: hir::StmtKind::Item(item_id),
46904690
span: s.span,
46914691
}
46924692
})

src/librustc/hir/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,9 @@ impl fmt::Debug for Stmt {
11751175
pub enum StmtKind {
11761176
/// A local (`let`) binding.
11771177
Local(P<Local>),
1178+
11781179
/// An item binding.
1179-
Item(P<ItemId>),
1180+
Item(ItemId),
11801181

11811182
/// An expression without a trailing semi-colon (must have unit type).
11821183
Expr(P<Expr>),

src/librustc/hir/print.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,8 @@ impl<'a> State<'a> {
10071007
}
10081008
self.end()?
10091009
}
1010-
hir::StmtKind::Item(ref item) => {
1011-
self.ann.nested(self, Nested::Item(**item))?
1010+
hir::StmtKind::Item(item) => {
1011+
self.ann.nested(self, Nested::Item(item))?
10121012
}
10131013
hir::StmtKind::Expr(ref expr) => {
10141014
self.space_if_not_bol()?;

0 commit comments

Comments
 (0)