diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 9467f86a22527..7e1130d9f233d 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1242,13 +1242,8 @@ impl<'hir> LoweringContext<'_, 'hir> { let rhs = self.lower_expr(rhs); // Introduce a `let` for destructuring: `let (lhs1, lhs2) = t`. - let destructure_let = self.stmt_let_pat( - None, - whole_span, - Some(rhs), - pat, - hir::LocalSource::AssignDesugar(self.lower_span(eq_sign_span)), - ); + let destructure_let = + self.stmt_let_pat(None, whole_span, Some(rhs), pat, hir::LocalSource::AssignDesugar); // `a = lhs1; b = lhs2;`. let stmts = self.arena.alloc_from_iter(std::iter::once(destructure_let).chain(assignments)); diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 38cb12cf24bcb..8b55a0d732994 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2975,8 +2975,7 @@ pub enum LocalSource { /// A desugared `.await`. AwaitDesugar, /// A desugared `expr = expr`, where the LHS is a tuple, struct, array or underscore expression. - /// The span is that of the `=` sign. - AssignDesugar(Span), + AssignDesugar, /// A contract `#[ensures(..)]` attribute injects a let binding for the check that runs at point of return. Contract, } @@ -5013,7 +5012,7 @@ mod size_asserts { static_assert_size!(ImplItemKind<'_>, 40); static_assert_size!(Item<'_>, 88); static_assert_size!(ItemKind<'_>, 64); - static_assert_size!(LetStmt<'_>, 72); + static_assert_size!(LetStmt<'_>, 64); static_assert_size!(Param<'_>, 32); static_assert_size!(Pat<'_>, 80); static_assert_size!(PatKind<'_>, 56); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 4d1c7be391977..abdb01bcefb2c 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -1112,8 +1112,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { hir::Stmt { kind: hir::StmtKind::Let(hir::LetStmt { - source: - hir::LocalSource::AssignDesugar(_), + source: hir::LocalSource::AssignDesugar, .. }), .. diff --git a/compiler/rustc_lint/src/let_underscore.rs b/compiler/rustc_lint/src/let_underscore.rs index 3e2c1af97f437..d061a56c93461 100644 --- a/compiler/rustc_lint/src/let_underscore.rs +++ b/compiler/rustc_lint/src/let_underscore.rs @@ -152,7 +152,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore { // We can't suggest `drop()` when we're on the top level. drop_fn_start_end: can_use_init .map(|init| (local.span.until(init.span), init.span.shrink_to_hi())), - is_assign_desugar: matches!(local.source, rustc_hir::LocalSource::AssignDesugar(_)), + is_assign_desugar: matches!(local.source, rustc_hir::LocalSource::AssignDesugar), }; if is_sync_lock { let span = MultiSpan::from_span(pat.span); diff --git a/compiler/rustc_mir_build/src/builder/matches/mod.rs b/compiler/rustc_mir_build/src/builder/matches/mod.rs index 926a3eb018ff0..82f12a969bb1c 100644 --- a/compiler/rustc_mir_build/src/builder/matches/mod.rs +++ b/compiler/rustc_mir_build/src/builder/matches/mod.rs @@ -2897,8 +2897,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { for (_, node) in tcx.hir_parent_iter(var_id.0) { // FIXME(khuey) at what point is it safe to bail on the iterator? // Can we stop at the first non-Pat node? - if matches!(node, Node::LetStmt(&LetStmt { source: LocalSource::AssignDesugar(_), .. })) - { + if matches!(node, Node::LetStmt(&LetStmt { source: LocalSource::AssignDesugar, .. })) { return false; } } diff --git a/src/tools/clippy/clippy_lints/src/shadow.rs b/src/tools/clippy/clippy_lints/src/shadow.rs index 7fdea6bec5100..f6083394fea52 100644 --- a/src/tools/clippy/clippy_lints/src/shadow.rs +++ b/src/tools/clippy/clippy_lints/src/shadow.rs @@ -133,7 +133,7 @@ impl<'tcx> LateLintPass<'tcx> for Shadow { .tcx .hir_parent_iter(pat.hir_id) .find(|(_, node)| !matches!(node, Node::Pat(_) | Node::PatField(_))) - && let LocalSource::AssignDesugar(_) = let_stmt.source + && let LocalSource::AssignDesugar = let_stmt.source { return; } diff --git a/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs b/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs index 9afa9d65c2613..9935dc309611f 100644 --- a/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs +++ b/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs @@ -374,7 +374,7 @@ fn expr_has_unnecessary_safety_comment<'tcx>( hir::Stmt { kind: hir::StmtKind::Let(hir::LetStmt { - source: hir::LocalSource::AssignDesugar(_), + source: hir::LocalSource::AssignDesugar, .. }), .. diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr index 4a73a4747ad0c..18862eeef06eb 100644 --- a/tests/ui/stats/input-stats.stderr +++ b/tests/ui/stats/input-stats.stderr @@ -105,10 +105,10 @@ hir-stats - Semi 32 (NN.N%) 1 hir-stats Arm 80 (NN.N%) 2 40 hir-stats WherePredicate 72 (NN.N%) 3 24 hir-stats - BoundPredicate 72 (NN.N%) 3 -hir-stats Local 72 (NN.N%) 1 72 hir-stats InlineAsm 72 (NN.N%) 1 72 hir-stats Body 72 (NN.N%) 3 24 hir-stats Param 64 (NN.N%) 2 32 +hir-stats Local 64 (NN.N%) 1 64 hir-stats GenericArg 64 (NN.N%) 4 16 hir-stats - Type 16 (NN.N%) 1 hir-stats - Lifetime 48 (NN.N%) 3 @@ -119,5 +119,5 @@ hir-stats TraitItemId 8 (NN.N%) 2 4 hir-stats ImplItemId 8 (NN.N%) 2 4 hir-stats ForeignItemId 4 (NN.N%) 1 4 hir-stats ---------------------------------------------------------------- -hir-stats Total 8_624 173 +hir-stats Total 8_616 173 hir-stats ================================================================