Remove AssignDesugar span
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
..
|
||||
}),
|
||||
..
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user