Remove AssignDesugar span
This commit is contained in:
@@ -1242,13 +1242,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||||||
let rhs = self.lower_expr(rhs);
|
let rhs = self.lower_expr(rhs);
|
||||||
|
|
||||||
// Introduce a `let` for destructuring: `let (lhs1, lhs2) = t`.
|
// Introduce a `let` for destructuring: `let (lhs1, lhs2) = t`.
|
||||||
let destructure_let = self.stmt_let_pat(
|
let destructure_let =
|
||||||
None,
|
self.stmt_let_pat(None, whole_span, Some(rhs), pat, hir::LocalSource::AssignDesugar);
|
||||||
whole_span,
|
|
||||||
Some(rhs),
|
|
||||||
pat,
|
|
||||||
hir::LocalSource::AssignDesugar(self.lower_span(eq_sign_span)),
|
|
||||||
);
|
|
||||||
|
|
||||||
// `a = lhs1; b = lhs2;`.
|
// `a = lhs1; b = lhs2;`.
|
||||||
let stmts = self.arena.alloc_from_iter(std::iter::once(destructure_let).chain(assignments));
|
let stmts = self.arena.alloc_from_iter(std::iter::once(destructure_let).chain(assignments));
|
||||||
|
|||||||
@@ -2975,8 +2975,7 @@ pub enum LocalSource {
|
|||||||
/// A desugared `<expr>.await`.
|
/// A desugared `<expr>.await`.
|
||||||
AwaitDesugar,
|
AwaitDesugar,
|
||||||
/// A desugared `expr = expr`, where the LHS is a tuple, struct, array or underscore expression.
|
/// A desugared `expr = expr`, where the LHS is a tuple, struct, array or underscore expression.
|
||||||
/// The span is that of the `=` sign.
|
AssignDesugar,
|
||||||
AssignDesugar(Span),
|
|
||||||
/// A contract `#[ensures(..)]` attribute injects a let binding for the check that runs at point of return.
|
/// A contract `#[ensures(..)]` attribute injects a let binding for the check that runs at point of return.
|
||||||
Contract,
|
Contract,
|
||||||
}
|
}
|
||||||
@@ -5013,7 +5012,7 @@ mod size_asserts {
|
|||||||
static_assert_size!(ImplItemKind<'_>, 40);
|
static_assert_size!(ImplItemKind<'_>, 40);
|
||||||
static_assert_size!(Item<'_>, 88);
|
static_assert_size!(Item<'_>, 88);
|
||||||
static_assert_size!(ItemKind<'_>, 64);
|
static_assert_size!(ItemKind<'_>, 64);
|
||||||
static_assert_size!(LetStmt<'_>, 72);
|
static_assert_size!(LetStmt<'_>, 64);
|
||||||
static_assert_size!(Param<'_>, 32);
|
static_assert_size!(Param<'_>, 32);
|
||||||
static_assert_size!(Pat<'_>, 80);
|
static_assert_size!(Pat<'_>, 80);
|
||||||
static_assert_size!(PatKind<'_>, 56);
|
static_assert_size!(PatKind<'_>, 56);
|
||||||
|
|||||||
@@ -1112,8 +1112,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
hir::Stmt {
|
hir::Stmt {
|
||||||
kind:
|
kind:
|
||||||
hir::StmtKind::Let(hir::LetStmt {
|
hir::StmtKind::Let(hir::LetStmt {
|
||||||
source:
|
source: hir::LocalSource::AssignDesugar,
|
||||||
hir::LocalSource::AssignDesugar(_),
|
|
||||||
..
|
..
|
||||||
}),
|
}),
|
||||||
..
|
..
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
|
|||||||
// We can't suggest `drop()` when we're on the top level.
|
// We can't suggest `drop()` when we're on the top level.
|
||||||
drop_fn_start_end: can_use_init
|
drop_fn_start_end: can_use_init
|
||||||
.map(|init| (local.span.until(init.span), init.span.shrink_to_hi())),
|
.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 {
|
if is_sync_lock {
|
||||||
let span = MultiSpan::from_span(pat.span);
|
let span = MultiSpan::from_span(pat.span);
|
||||||
|
|||||||
@@ -2897,8 +2897,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
for (_, node) in tcx.hir_parent_iter(var_id.0) {
|
for (_, node) in tcx.hir_parent_iter(var_id.0) {
|
||||||
// FIXME(khuey) at what point is it safe to bail on the iterator?
|
// FIXME(khuey) at what point is it safe to bail on the iterator?
|
||||||
// Can we stop at the first non-Pat node?
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ impl<'tcx> LateLintPass<'tcx> for Shadow {
|
|||||||
.tcx
|
.tcx
|
||||||
.hir_parent_iter(pat.hir_id)
|
.hir_parent_iter(pat.hir_id)
|
||||||
.find(|(_, node)| !matches!(node, Node::Pat(_) | Node::PatField(_)))
|
.find(|(_, node)| !matches!(node, Node::Pat(_) | Node::PatField(_)))
|
||||||
&& let LocalSource::AssignDesugar(_) = let_stmt.source
|
&& let LocalSource::AssignDesugar = let_stmt.source
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ fn expr_has_unnecessary_safety_comment<'tcx>(
|
|||||||
hir::Stmt {
|
hir::Stmt {
|
||||||
kind:
|
kind:
|
||||||
hir::StmtKind::Let(hir::LetStmt {
|
hir::StmtKind::Let(hir::LetStmt {
|
||||||
source: hir::LocalSource::AssignDesugar(_),
|
source: hir::LocalSource::AssignDesugar,
|
||||||
..
|
..
|
||||||
}),
|
}),
|
||||||
..
|
..
|
||||||
|
|||||||
@@ -105,10 +105,10 @@ hir-stats - Semi 32 (NN.N%) 1
|
|||||||
hir-stats Arm 80 (NN.N%) 2 40
|
hir-stats Arm 80 (NN.N%) 2 40
|
||||||
hir-stats WherePredicate 72 (NN.N%) 3 24
|
hir-stats WherePredicate 72 (NN.N%) 3 24
|
||||||
hir-stats - BoundPredicate 72 (NN.N%) 3
|
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 InlineAsm 72 (NN.N%) 1 72
|
||||||
hir-stats Body 72 (NN.N%) 3 24
|
hir-stats Body 72 (NN.N%) 3 24
|
||||||
hir-stats Param 64 (NN.N%) 2 32
|
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 GenericArg 64 (NN.N%) 4 16
|
||||||
hir-stats - Type 16 (NN.N%) 1
|
hir-stats - Type 16 (NN.N%) 1
|
||||||
hir-stats - Lifetime 48 (NN.N%) 3
|
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 ImplItemId 8 (NN.N%) 2 4
|
||||||
hir-stats ForeignItemId 4 (NN.N%) 1 4
|
hir-stats ForeignItemId 4 (NN.N%) 1 4
|
||||||
hir-stats ----------------------------------------------------------------
|
hir-stats ----------------------------------------------------------------
|
||||||
hir-stats Total 8_624 173
|
hir-stats Total 8_616 173
|
||||||
hir-stats ================================================================
|
hir-stats ================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user