Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e0d3439

Browse files
Rename hir::Node::Local into hir::Node::LetStmt
1 parent d318bf1 commit e0d3439

File tree

43 files changed

+78
-77
lines changed

Some content is hidden

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

43 files changed

+78
-77
lines changed

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
303303
}
304304

305305
fn visit_local(&mut self, l: &'hir LetStmt<'hir>) {
306-
self.insert(l.span, l.hir_id, Node::Local(l));
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
})

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
800800
for (_, node) in tcx.hir().parent_iter(expr.hir_id) {
801801
let e = match node {
802802
hir::Node::Expr(e) => e,
803-
hir::Node::Local(hir::LetStmt { els: Some(els), .. }) => {
803+
hir::Node::LetStmt(hir::LetStmt { els: Some(els), .. }) => {
804804
let mut finder = BreakFinder { found_breaks: vec![], found_continues: vec![] };
805805
finder.visit_block(els);
806806
if !finder.found_breaks.is_empty() {

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
737737
&& let body = self.infcx.tcx.hir().body(body_id)
738738
&& let Some(hir_id) = (BindingFinder { span: pat_span }).visit_body(body).break_value()
739739
&& let node = self.infcx.tcx.hir_node(hir_id)
740-
&& let hir::Node::Local(hir::LetStmt {
740+
&& let hir::Node::LetStmt(hir::LetStmt {
741741
pat: hir::Pat { kind: hir::PatKind::Ref(_, _), .. },
742742
..
743743
})
@@ -1170,7 +1170,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
11701170
};
11711171

11721172
if let Some(hir_id) = hir_id
1173-
&& let hir::Node::Local(local) = self.infcx.tcx.hir_node(hir_id)
1173+
&& let hir::Node::LetStmt(local) = self.infcx.tcx.hir_node(hir_id)
11741174
{
11751175
let tables = self.infcx.tcx.typeck(def_id.as_local().unwrap());
11761176
if let Some(clone_trait) = self.infcx.tcx.lang_items().clone_trait()

compiler/rustc_hir/src/hir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,7 +3529,7 @@ pub enum Node<'hir> {
35293529
PatField(&'hir PatField<'hir>),
35303530
Arm(&'hir Arm<'hir>),
35313531
Block(&'hir Block<'hir>),
3532-
Local(&'hir LetStmt<'hir>),
3532+
LetStmt(&'hir LetStmt<'hir>),
35333533
/// `Ctor` refers to the constructor of an enum variant or struct. Only tuple or unit variants
35343534
/// with synthesized constructors.
35353535
Ctor(&'hir VariantData<'hir>),
@@ -3585,7 +3585,7 @@ impl<'hir> Node<'hir> {
35853585
| Node::Ctor(..)
35863586
| Node::Pat(..)
35873587
| Node::Arm(..)
3588-
| Node::Local(..)
3588+
| Node::LetStmt(..)
35893589
| Node::Crate(..)
35903590
| Node::Ty(..)
35913591
| Node::TraitRef(..)
@@ -3757,7 +3757,7 @@ impl<'hir> Node<'hir> {
37573757
expect_pat_field, &'hir PatField<'hir>, Node::PatField(n), n;
37583758
expect_arm, &'hir Arm<'hir>, Node::Arm(n), n;
37593759
expect_block, &'hir Block<'hir>, Node::Block(n), n;
3760-
expect_let_stmt, &'hir LetStmt<'hir>, Node::Local(n), n;
3760+
expect_let_stmt, &'hir LetStmt<'hir>, Node::LetStmt(n), n;
37613761
expect_ctor, &'hir VariantData<'hir>, Node::Ctor(n), n;
37623762
expect_lifetime, &'hir Lifetime, Node::Lifetime(n), n;
37633763
expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'a> State<'a> {
113113
// `hir_map` to reconstruct their full structure for pretty
114114
// printing.
115115
Node::Ctor(..) => panic!("cannot print isolated Ctor"),
116-
Node::Local(a) => self.print_local_decl(a),
116+
Node::LetStmt(a) => self.print_local_decl(a),
117117
Node::Crate(..) => panic!("cannot print Crate"),
118118
Node::WhereBoundPredicate(pred) => {
119119
self.print_formal_generic_params(pred.bound_generic_params);

compiler/rustc_hir_typeck/src/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
408408
}
409409
}
410410
}
411-
if let hir::Node::Local(hir::LetStmt { ty: Some(_), pat, .. }) = node {
411+
if let hir::Node::LetStmt(hir::LetStmt { ty: Some(_), pat, .. }) = node {
412412
return Some((pat.span, "expected because of this assignment".to_string()));
413413
}
414414
None

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
299299
return false;
300300
};
301301
let (init_ty_hir_id, init) = match self.tcx.parent_hir_node(pat.hir_id) {
302-
hir::Node::Local(hir::LetStmt { ty: Some(ty), init, .. }) => (ty.hir_id, *init),
303-
hir::Node::Local(hir::LetStmt { init: Some(init), .. }) => (init.hir_id, Some(*init)),
302+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), init, .. }) => (ty.hir_id, *init),
303+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => (init.hir_id, Some(*init)),
304304
_ => return false,
305305
};
306306
let Some(init_ty) = self.node_ty_opt(init_ty_hir_id) else {
@@ -678,7 +678,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
678678
error: Option<TypeError<'tcx>>,
679679
) {
680680
match (self.tcx.parent_hir_node(expr.hir_id), error) {
681-
(hir::Node::Local(hir::LetStmt { ty: Some(ty), init: Some(init), .. }), _)
681+
(hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), init: Some(init), .. }), _)
682682
if init.hir_id == expr.hir_id =>
683683
{
684684
// Point at `let` assignment type.
@@ -724,11 +724,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
724724
primary_span = pat.span;
725725
secondary_span = pat.span;
726726
match self.tcx.parent_hir_node(pat.hir_id) {
727-
hir::Node::Local(hir::LetStmt { ty: Some(ty), .. }) => {
727+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), .. }) => {
728728
primary_span = ty.span;
729729
post_message = " type";
730730
}
731-
hir::Node::Local(hir::LetStmt { init: Some(init), .. }) => {
731+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => {
732732
primary_span = init.span;
733733
post_message = " value";
734734
}

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14521452
});
14531453
let Some((
14541454
_,
1455-
hir::Node::Local(hir::LetStmt { ty: Some(ty), .. })
1455+
hir::Node::LetStmt(hir::LetStmt { ty: Some(ty), .. })
14561456
| hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _, _), .. }),
14571457
)) = parent_node
14581458
else {

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
318318
);
319319
expr_id = parent_id;
320320
}
321-
Node::Local(local) => {
321+
Node::LetStmt(local) => {
322322
if let Some(mut ty) = local.ty {
323323
while let Some(index) = tuple_indexes.pop() {
324324
match ty.kind {
@@ -1331,7 +1331,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13311331
// ++++++++++
13321332
// since the user probably just misunderstood how `let else`
13331333
// and `&&` work together.
1334-
if let Some((_, hir::Node::Local(local))) = cond_parent
1334+
if let Some((_, hir::Node::LetStmt(local))) = cond_parent
13351335
&& let hir::PatKind::Path(qpath) | hir::PatKind::TupleStruct(qpath, _, _) =
13361336
&local.pat.kind
13371337
&& let hir::QPath::Resolved(None, path) = qpath
@@ -1731,7 +1731,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17311731

17321732
match self.tcx.parent_hir_node(*hir_id) {
17331733
// foo.clone()
1734-
hir::Node::Local(hir::LetStmt { init: Some(init), .. }) => {
1734+
hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) => {
17351735
self.note_type_is_not_clone_inner_expr(init)
17361736
}
17371737
// When `expr` is more complex like a tuple
@@ -1740,7 +1740,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17401740
kind: hir::PatKind::Tuple(pats, ..),
17411741
..
17421742
}) => {
1743-
let hir::Node::Local(hir::LetStmt { init: Some(init), .. }) =
1743+
let hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) =
17441744
self.tcx.parent_hir_node(*pat_hir_id)
17451745
else {
17461746
return expr;
@@ -1774,7 +1774,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17741774
&& let hir::Path { segments: [_], res: crate::Res::Local(binding), .. } =
17751775
call_expr_path
17761776
&& let hir::Node::Pat(hir::Pat { hir_id, .. }) = self.tcx.hir_node(*binding)
1777-
&& let hir::Node::Local(hir::LetStmt { init: Some(init), .. }) =
1777+
&& let hir::Node::LetStmt(hir::LetStmt { init: Some(init), .. }) =
17781778
self.tcx.parent_hir_node(*hir_id)
17791779
&& let Expr {
17801780
kind: hir::ExprKind::Closure(hir::Closure { body: body_id, .. }),
@@ -3134,7 +3134,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
31343134
let hir::Node::Pat(pat) = self.tcx.hir_node(hir_id) else {
31353135
return;
31363136
};
3137-
let hir::Node::Local(hir::LetStmt { ty: None, init: Some(init), .. }) =
3137+
let hir::Node::LetStmt(hir::LetStmt { ty: None, init: Some(init), .. }) =
31383138
self.tcx.parent_hir_node(pat.hir_id)
31393139
else {
31403140
return;

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21662166
match (filename, parent_node) {
21672167
(
21682168
FileName::Real(_),
2169-
Node::Local(hir::LetStmt {
2169+
Node::LetStmt(hir::LetStmt {
21702170
source: hir::LocalSource::Normal,
21712171
ty,
21722172
..

0 commit comments

Comments
 (0)