Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2975,8 +2975,7 @@ pub enum LocalSource {
/// A desugared `<expr>.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,
}
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
..
}),
..
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/let_underscore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_mir_build/src/builder/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
..
}),
..
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/stats/input-stats.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ================================================================
Loading