Skip to content

Commit 58ad763

Browse files
authored
Rollup merge of rust-lang#139467 - compiler-errors:more-trivial-tweaks, r=oli-obk
More trivial tweaks Found some really tiny nits when trying to find places that span tracking caused queries to be recomputed in incremental; these probably don't need a perf run b/c they're so simple. r? oli-obk
2 parents 1b8dbda + c51c448 commit 58ad763

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

Diff for: compiler/rustc_hir_analysis/src/check/region.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -446,14 +446,11 @@ fn resolve_expr<'tcx>(
446446
// Mark this expr's scope and all parent scopes as containing `yield`.
447447
let mut scope = Scope { local_id: expr.hir_id.local_id, data: ScopeData::Node };
448448
loop {
449-
let span = match expr.kind {
450-
hir::ExprKind::Yield(expr, hir::YieldSource::Await { .. }) => {
451-
expr.span.shrink_to_hi().to(expr.span)
452-
}
453-
_ => expr.span,
449+
let data = YieldData {
450+
span: expr.span,
451+
expr_and_pat_count: visitor.expr_and_pat_count,
452+
source: *source,
454453
};
455-
let data =
456-
YieldData { span, expr_and_pat_count: visitor.expr_and_pat_count, source: *source };
457454
match visitor.scope_tree.yield_in_scope.get_mut(&scope) {
458455
Some(yields) => yields.push(data),
459456
None => {

Diff for: compiler/rustc_hir_typeck/src/demand.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
865865
// `&'name Ty` -> `&'name mut Ty` or `&Ty` -> `&mut Ty`
866866
vec![(
867867
ty_ref.1.ty.span.shrink_to_lo(),
868-
format!(
869-
"{}mut ",
870-
if ty_ref.0.ident.span.lo() == ty_ref.0.ident.span.hi() { "" } else { " " },
871-
),
868+
format!("{}mut ", if ty_ref.0.ident.span.is_empty() { "" } else { " " },),
872869
)]
873870
};
874871
sugg.extend([

Diff for: compiler/rustc_passes/src/liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
16551655
// `&'name Ty` -> `&'name mut Ty` or `&Ty` -> `&mut Ty`
16561656
Some(mut_ty.ty.span.shrink_to_lo())
16571657
};
1658-
let pre = if lt.ident.span.lo() == lt.ident.span.hi() { "" } else { " " };
1658+
let pre = if lt.ident.span.is_empty() { "" } else { " " };
16591659
Some(errors::UnusedAssignSuggestion {
16601660
ty_span,
16611661
pre,

0 commit comments

Comments
 (0)