Skip to content

Commit 907705a

Browse files
committed
Auto merge of #148208 - camsteffen:assign-desugar-span, r=wesleywiser
Remove unused `AssignDesugar` span
2 parents 044d68c + a45c6dd commit 907705a

File tree

8 files changed

+11
-19
lines changed

8 files changed

+11
-19
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,13 +1242,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
12421242
let rhs = self.lower_expr(rhs);
12431243

12441244
// Introduce a `let` for destructuring: `let (lhs1, lhs2) = t`.
1245-
let destructure_let = self.stmt_let_pat(
1246-
None,
1247-
whole_span,
1248-
Some(rhs),
1249-
pat,
1250-
hir::LocalSource::AssignDesugar(self.lower_span(eq_sign_span)),
1251-
);
1245+
let destructure_let =
1246+
self.stmt_let_pat(None, whole_span, Some(rhs), pat, hir::LocalSource::AssignDesugar);
12521247

12531248
// `a = lhs1; b = lhs2;`.
12541249
let stmts = self.arena.alloc_from_iter(std::iter::once(destructure_let).chain(assignments));

compiler/rustc_hir/src/hir.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,8 +2975,7 @@ pub enum LocalSource {
29752975
/// A desugared `<expr>.await`.
29762976
AwaitDesugar,
29772977
/// A desugared `expr = expr`, where the LHS is a tuple, struct, array or underscore expression.
2978-
/// The span is that of the `=` sign.
2979-
AssignDesugar(Span),
2978+
AssignDesugar,
29802979
/// A contract `#[ensures(..)]` attribute injects a let binding for the check that runs at point of return.
29812980
Contract,
29822981
}
@@ -5013,7 +5012,7 @@ mod size_asserts {
50135012
static_assert_size!(ImplItemKind<'_>, 40);
50145013
static_assert_size!(Item<'_>, 88);
50155014
static_assert_size!(ItemKind<'_>, 64);
5016-
static_assert_size!(LetStmt<'_>, 72);
5015+
static_assert_size!(LetStmt<'_>, 64);
50175016
static_assert_size!(Param<'_>, 32);
50185017
static_assert_size!(Pat<'_>, 80);
50195018
static_assert_size!(PatKind<'_>, 56);

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11121112
hir::Stmt {
11131113
kind:
11141114
hir::StmtKind::Let(hir::LetStmt {
1115-
source:
1116-
hir::LocalSource::AssignDesugar(_),
1115+
source: hir::LocalSource::AssignDesugar,
11171116
..
11181117
}),
11191118
..

compiler/rustc_lint/src/let_underscore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
152152
// We can't suggest `drop()` when we're on the top level.
153153
drop_fn_start_end: can_use_init
154154
.map(|init| (local.span.until(init.span), init.span.shrink_to_hi())),
155-
is_assign_desugar: matches!(local.source, rustc_hir::LocalSource::AssignDesugar(_)),
155+
is_assign_desugar: matches!(local.source, rustc_hir::LocalSource::AssignDesugar),
156156
};
157157
if is_sync_lock {
158158
let span = MultiSpan::from_span(pat.span);

compiler/rustc_mir_build/src/builder/matches/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,8 +2897,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
28972897
for (_, node) in tcx.hir_parent_iter(var_id.0) {
28982898
// FIXME(khuey) at what point is it safe to bail on the iterator?
28992899
// Can we stop at the first non-Pat node?
2900-
if matches!(node, Node::LetStmt(&LetStmt { source: LocalSource::AssignDesugar(_), .. }))
2901-
{
2900+
if matches!(node, Node::LetStmt(&LetStmt { source: LocalSource::AssignDesugar, .. })) {
29022901
return false;
29032902
}
29042903
}

src/tools/clippy/clippy_lints/src/shadow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'tcx> LateLintPass<'tcx> for Shadow {
133133
.tcx
134134
.hir_parent_iter(pat.hir_id)
135135
.find(|(_, node)| !matches!(node, Node::Pat(_) | Node::PatField(_)))
136-
&& let LocalSource::AssignDesugar(_) = let_stmt.source
136+
&& let LocalSource::AssignDesugar = let_stmt.source
137137
{
138138
return;
139139
}

src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ fn expr_has_unnecessary_safety_comment<'tcx>(
374374
hir::Stmt {
375375
kind:
376376
hir::StmtKind::Let(hir::LetStmt {
377-
source: hir::LocalSource::AssignDesugar(_),
377+
source: hir::LocalSource::AssignDesugar,
378378
..
379379
}),
380380
..

tests/ui/stats/input-stats.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ hir-stats - Semi 32 (NN.N%) 1
105105
hir-stats Arm 80 (NN.N%) 2 40
106106
hir-stats WherePredicate 72 (NN.N%) 3 24
107107
hir-stats - BoundPredicate 72 (NN.N%) 3
108-
hir-stats Local 72 (NN.N%) 1 72
109108
hir-stats InlineAsm 72 (NN.N%) 1 72
110109
hir-stats Body 72 (NN.N%) 3 24
111110
hir-stats Param 64 (NN.N%) 2 32
111+
hir-stats Local 64 (NN.N%) 1 64
112112
hir-stats GenericArg 64 (NN.N%) 4 16
113113
hir-stats - Type 16 (NN.N%) 1
114114
hir-stats - Lifetime 48 (NN.N%) 3
@@ -119,5 +119,5 @@ hir-stats TraitItemId 8 (NN.N%) 2 4
119119
hir-stats ImplItemId 8 (NN.N%) 2 4
120120
hir-stats ForeignItemId 4 (NN.N%) 1 4
121121
hir-stats ----------------------------------------------------------------
122-
hir-stats Total 8_624 173
122+
hir-stats Total 8_616 173
123123
hir-stats ================================================================

0 commit comments

Comments
 (0)