Skip to content

Commit 99e34b4

Browse files
authoredMar 23, 2024
Rollup merge of #122780 - GuillaumeGomez:rename-hir-local, r=oli-obk
Rename `hir::Local` into `hir::LetStmt` Follow-up of #122776. As discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F). I made this change into a separate PR because I'm less sure about this change as is. For example, we have `visit_local` and `LocalSource` items. Is it fine to keep these two as is (I supposed it is but I prefer to ask) or not? Having `Node::Local(LetStmt)` makes things more explicit but is it going too far? r? ```@oli-obk```
2 parents 154d096 + e0d3439 commit 99e34b4

File tree

82 files changed

+178
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+178
-177
lines changed
 

‎compiler/rustc_ast_lowering/src/block.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
8181
(self.arena.alloc_from_iter(stmts), expr)
8282
}
8383

84-
fn lower_local(&mut self, l: &Local) -> &'hir hir::Local<'hir> {
84+
fn lower_local(&mut self, l: &Local) -> &'hir hir::LetStmt<'hir> {
8585
let ty = l
8686
.ty
8787
.as_ref()
@@ -97,7 +97,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
9797
let span = self.lower_span(l.span);
9898
let source = hir::LocalSource::Normal;
9999
self.lower_attrs(hir_id, &l.attrs);
100-
self.arena.alloc(hir::Local { hir_id, ty, pat, init, els, span, source })
100+
self.arena.alloc(hir::LetStmt { hir_id, ty, pat, init, els, span, source })
101101
}
102102

103103
fn lower_block_check_mode(&mut self, b: &BlockCheckMode) -> hir::BlockCheckMode {

‎compiler/rustc_ast_lowering/src/index.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
302302
});
303303
}
304304

305-
fn visit_local(&mut self, l: &'hir Local<'hir>) {
306-
self.insert(l.span, l.hir_id, Node::Local(l));
305+
fn visit_local(&mut self, l: &'hir LetStmt<'hir>) {
306+
self.insert(l.span, l.hir_id, Node::LetStmt(l));
307307
self.with_parent(l.hir_id, |this| {
308308
intravisit::walk_local(this, l);
309309
})

0 commit comments

Comments
 (0)