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

Commit ca9f063

Browse files
Rename ast::StmtKind::Local into ast::StmtKind::Let
1 parent 6f3eb1c commit ca9f063

File tree

17 files changed

+24
-24
lines changed

17 files changed

+24
-24
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ impl Stmt {
10211021
#[derive(Clone, Encodable, Decodable, Debug)]
10221022
pub enum StmtKind {
10231023
/// A local (let) binding.
1024-
Local(P<Local>),
1024+
Let(P<Local>),
10251025
/// An item definition.
10261026
Item(P<Item>),
10271027
/// Expr without trailing semi-colon.

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl<T: HasTokens> HasTokens for Option<T> {
182182
impl HasTokens for StmtKind {
183183
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
184184
match self {
185-
StmtKind::Local(local) => local.tokens.as_ref(),
185+
StmtKind::Let(local) => local.tokens.as_ref(),
186186
StmtKind::Item(item) => item.tokens(),
187187
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.tokens(),
188188
StmtKind::Empty => return None,
@@ -191,7 +191,7 @@ impl HasTokens for StmtKind {
191191
}
192192
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
193193
match self {
194-
StmtKind::Local(local) => Some(&mut local.tokens),
194+
StmtKind::Let(local) => Some(&mut local.tokens),
195195
StmtKind::Item(item) => item.tokens_mut(),
196196
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.tokens_mut(),
197197
StmtKind::Empty => return None,
@@ -355,7 +355,7 @@ impl HasAttrs for StmtKind {
355355

356356
fn attrs(&self) -> &[Attribute] {
357357
match self {
358-
StmtKind::Local(local) => &local.attrs,
358+
StmtKind::Let(local) => &local.attrs,
359359
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.attrs(),
360360
StmtKind::Item(item) => item.attrs(),
361361
StmtKind::Empty => &[],
@@ -365,7 +365,7 @@ impl HasAttrs for StmtKind {
365365

366366
fn visit_attrs(&mut self, f: impl FnOnce(&mut AttrVec)) {
367367
match self {
368-
StmtKind::Local(local) => f(&mut local.attrs),
368+
StmtKind::Let(local) => f(&mut local.attrs),
369369
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.visit_attrs(f),
370370
StmtKind::Item(item) => item.visit_attrs(f),
371371
StmtKind::Empty => {}

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ pub fn noop_flat_map_stmt_kind<T: MutVisitor>(
15671567
vis: &mut T,
15681568
) -> SmallVec<[StmtKind; 1]> {
15691569
match kind {
1570-
StmtKind::Local(mut local) => smallvec![StmtKind::Local({
1570+
StmtKind::Let(mut local) => smallvec![StmtKind::Let({
15711571
vis.visit_local(&mut local);
15721572
local
15731573
})],

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) -> V::R
787787

788788
pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) -> V::Result {
789789
match &statement.kind {
790-
StmtKind::Local(local) => try_visit!(visitor.visit_local(local)),
790+
StmtKind::Let(local) => try_visit!(visitor.visit_local(local)),
791791
StmtKind::Item(item) => try_visit!(visitor.visit_item(item)),
792792
StmtKind::Expr(expr) | StmtKind::Semi(expr) => try_visit!(visitor.visit_expr(expr)),
793793
StmtKind::Empty => {}

compiler/rustc_ast_lowering/src/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3232
let mut expr = None;
3333
while let [s, tail @ ..] = ast_stmts {
3434
match &s.kind {
35-
StmtKind::Local(local) => {
35+
StmtKind::Let(local) => {
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);

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ impl<'a> State<'a> {
12121212
fn print_stmt(&mut self, st: &ast::Stmt) {
12131213
self.maybe_print_comment(st.span.lo());
12141214
match &st.kind {
1215-
ast::StmtKind::Local(loc) => {
1215+
ast::StmtKind::Let(loc) => {
12161216
self.print_outer_attributes(&loc.attrs);
12171217
self.space_if_not_bol();
12181218
self.ibox(INDENT_UNIT);

compiler/rustc_expand/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'a> ExtCtxt<'a> {
218218
}
219219

220220
pub fn stmt_local(&self, local: P<ast::Local>, span: Span) -> ast::Stmt {
221-
ast::Stmt { id: ast::DUMMY_NODE_ID, kind: ast::StmtKind::Local(local), span }
221+
ast::Stmt { id: ast::DUMMY_NODE_ID, kind: ast::StmtKind::Let(local), span }
222222
}
223223

224224
pub fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> ast::Stmt {

compiler/rustc_expand/src/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ impl InvocationCollectorNode for ast::Stmt {
13891389
StmtKind::Item(item) => matches!(item.kind, ItemKind::MacCall(..)),
13901390
StmtKind::Semi(expr) => matches!(expr.kind, ExprKind::MacCall(..)),
13911391
StmtKind::Expr(..) => unreachable!(),
1392-
StmtKind::Local(..) | StmtKind::Empty => false,
1392+
StmtKind::Let(..) | StmtKind::Empty => false,
13931393
}
13941394
}
13951395
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {

compiler/rustc_lint/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
989989
impl EarlyLintPass for UnusedDocComment {
990990
fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) {
991991
let kind = match stmt.kind {
992-
ast::StmtKind::Local(..) => "statements",
992+
ast::StmtKind::Let(..) => "statements",
993993
// Disabled pending discussion in #78306
994994
ast::StmtKind::Item(..) => return,
995995
// expressions will be reported by `check_expr`.

compiler/rustc_lint/src/unused.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ trait UnusedDelimLint {
914914

915915
fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) {
916916
match s.kind {
917-
StmtKind::Local(ref local) if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX => {
917+
StmtKind::Let(ref local) if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX => {
918918
if let Some((init, els)) = local.kind.init_else_opt() {
919919
let ctx = match els {
920920
None => UnusedDelimsCtx::AssignedValue,
@@ -1189,7 +1189,7 @@ impl EarlyLintPass for UnusedParens {
11891189
}
11901190

11911191
fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) {
1192-
if let StmtKind::Local(ref local) = s.kind {
1192+
if let StmtKind::Let(ref local) = s.kind {
11931193
self.check_unused_parens_pat(cx, &local.pat, true, false, (true, false));
11941194
}
11951195

0 commit comments

Comments
 (0)