Skip to content

Commit a4e0e50

Browse files
Rename hir::StmtKind::Local into hir::StmtKind::Let
1 parent ca9f063 commit a4e0e50

Some content is hidden

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

58 files changed

+76
-76
lines changed

compiler/rustc_ast_lowering/src/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3636
let hir_id = self.lower_node_id(s.id);
3737
let local = self.lower_local(local);
3838
self.alias_attrs(hir_id, local.hir_id);
39-
let kind = hir::StmtKind::Local(local);
39+
let kind = hir::StmtKind::Let(local);
4040
let span = self.lower_span(s.span);
4141
stmts.push(hir::Stmt { hir_id, kind, span });
4242
}

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23562356
span: self.lower_span(span),
23572357
ty: None,
23582358
};
2359-
self.stmt(span, hir::StmtKind::Local(self.arena.alloc(local)))
2359+
self.stmt(span, hir::StmtKind::Let(self.arena.alloc(local)))
23602360
}
23612361

23622362
fn block_expr(&mut self, expr: &'hir hir::Expr<'hir>) -> &'hir hir::Block<'hir> {

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
616616

617617
// FIXME: We make sure that this is a normal top-level binding,
618618
// but we could suggest `todo!()` for all uninitalized bindings in the pattern pattern
619-
if let hir::StmtKind::Local(hir::Local { span, ty, init: None, pat, .. }) =
619+
if let hir::StmtKind::Let(hir::Local { span, ty, init: None, pat, .. }) =
620620
&ex.kind
621621
&& let hir::PatKind::Binding(..) = pat.kind
622622
&& span.contains(self.decl_span)

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
558558
hir::intravisit::walk_stmt(self, stmt);
559559
let expr = match stmt.kind {
560560
hir::StmtKind::Semi(expr) | hir::StmtKind::Expr(expr) => expr,
561-
hir::StmtKind::Local(hir::Local { init: Some(expr), .. }) => expr,
561+
hir::StmtKind::Let(hir::Local { init: Some(expr), .. }) => expr,
562562
_ => {
563563
return;
564564
}
@@ -1305,7 +1305,7 @@ struct BindingFinder {
13051305
impl<'tcx> Visitor<'tcx> for BindingFinder {
13061306
type Result = ControlFlow<hir::HirId>;
13071307
fn visit_stmt(&mut self, s: &'tcx hir::Stmt<'tcx>) -> Self::Result {
1308-
if let hir::StmtKind::Local(local) = s.kind
1308+
if let hir::StmtKind::Let(local) = s.kind
13091309
&& local.pat.span == self.span
13101310
{
13111311
ControlFlow::Break(local.hir_id)

compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ pub struct Stmt<'hir> {
12091209
#[derive(Debug, Clone, Copy, HashStable_Generic)]
12101210
pub enum StmtKind<'hir> {
12111211
/// A local (`let`) binding.
1212-
Local(&'hir Local<'hir>),
1212+
Let(&'hir Local<'hir>),
12131213

12141214
/// An item binding.
12151215
Item(ItemId),

compiler/rustc_hir/src/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block<'v>) ->
627627
pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) -> V::Result {
628628
try_visit!(visitor.visit_id(statement.hir_id));
629629
match statement.kind {
630-
StmtKind::Local(ref local) => visitor.visit_local(local),
630+
StmtKind::Let(ref local) => visitor.visit_local(local),
631631
StmtKind::Item(item) => visitor.visit_nested_item(item),
632632
StmtKind::Expr(ref expression) | StmtKind::Semi(ref expression) => {
633633
visitor.visit_expr(expression)

compiler/rustc_hir_analysis/src/check/errs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn maybe_expr_static_mut(tcx: TyCtxt<'_>, expr: hir::Expr<'_>) {
2727

2828
/// Check for shared or mutable references of `static mut` inside statement
2929
pub fn maybe_stmt_static_mut(tcx: TyCtxt<'_>, stmt: hir::Stmt<'_>) {
30-
if let hir::StmtKind::Local(loc) = stmt.kind
30+
if let hir::StmtKind::Let(loc) = stmt.kind
3131
&& let hir::PatKind::Binding(ba, _, _, _) = loc.pat.kind
3232
&& matches!(ba.0, rustc_ast::ByRef::Yes)
3333
&& let Some(init) = loc.init

compiler/rustc_hir_analysis/src/check/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
123123

124124
for (i, statement) in blk.stmts.iter().enumerate() {
125125
match statement.kind {
126-
hir::StmtKind::Local(hir::Local { els: Some(els), .. }) => {
126+
hir::StmtKind::Let(hir::Local { els: Some(els), .. }) => {
127127
// Let-else has a special lexical structure for variables.
128128
// First we take a checkpoint of the current scope context here.
129129
let mut prev_cx = visitor.cx;
@@ -146,7 +146,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
146146
// From now on, we continue normally.
147147
visitor.cx = prev_cx;
148148
}
149-
hir::StmtKind::Local(..) => {
149+
hir::StmtKind::Let(..) => {
150150
// Each declaration introduces a subscope for bindings
151151
// introduced by the declaration; this subscope covers a
152152
// suffix of the block. Each subscope in a block has the

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ impl<'a> State<'a> {
863863
fn print_stmt(&mut self, st: &hir::Stmt<'_>) {
864864
self.maybe_print_comment(st.span.lo());
865865
match st.kind {
866-
hir::StmtKind::Local(loc) => {
866+
hir::StmtKind::Let(loc) => {
867867
self.print_local(loc.init, loc.els, |this| this.print_local_decl(loc));
868868
}
869869
hir::StmtKind::Item(item) => self.ann.nested(self, Nested::Item(item)),
@@ -2306,7 +2306,7 @@ fn expr_requires_semi_to_be_stmt(e: &hir::Expr<'_>) -> bool {
23062306
/// seen the semicolon, and thus don't need another.
23072307
fn stmt_ends_with_semi(stmt: &hir::StmtKind<'_>) -> bool {
23082308
match *stmt {
2309-
hir::StmtKind::Local(_) => true,
2309+
hir::StmtKind::Let(_) => true,
23102310
hir::StmtKind::Item(_) => false,
23112311
hir::StmtKind::Expr(e) => expr_requires_semi_to_be_stmt(e),
23122312
hir::StmtKind::Semi(..) => false,

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
371371

372372
fn walk_stmt(&mut self, stmt: &hir::Stmt<'_>) {
373373
match stmt.kind {
374-
hir::StmtKind::Local(hir::Local { pat, init: Some(expr), els, .. }) => {
374+
hir::StmtKind::Let(hir::Local { pat, init: Some(expr), els, .. }) => {
375375
self.walk_local(expr, pat, *els, |_| {})
376376
}
377377

378-
hir::StmtKind::Local(_) => {}
378+
hir::StmtKind::Let(_) => {}
379379

380380
hir::StmtKind::Item(_) => {
381381
// We don't visit nested items in this visitor,

0 commit comments

Comments
 (0)