Rollup merge of #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
This commit is contained in:
commit
58ad76313f
3 changed files with 6 additions and 12 deletions
|
@ -446,14 +446,11 @@ fn resolve_expr<'tcx>(
|
||||||
// Mark this expr's scope and all parent scopes as containing `yield`.
|
// Mark this expr's scope and all parent scopes as containing `yield`.
|
||||||
let mut scope = Scope { local_id: expr.hir_id.local_id, data: ScopeData::Node };
|
let mut scope = Scope { local_id: expr.hir_id.local_id, data: ScopeData::Node };
|
||||||
loop {
|
loop {
|
||||||
let span = match expr.kind {
|
let data = YieldData {
|
||||||
hir::ExprKind::Yield(expr, hir::YieldSource::Await { .. }) => {
|
span: expr.span,
|
||||||
expr.span.shrink_to_hi().to(expr.span)
|
expr_and_pat_count: visitor.expr_and_pat_count,
|
||||||
}
|
source: *source,
|
||||||
_ => expr.span,
|
|
||||||
};
|
};
|
||||||
let data =
|
|
||||||
YieldData { span, expr_and_pat_count: visitor.expr_and_pat_count, source: *source };
|
|
||||||
match visitor.scope_tree.yield_in_scope.get_mut(&scope) {
|
match visitor.scope_tree.yield_in_scope.get_mut(&scope) {
|
||||||
Some(yields) => yields.push(data),
|
Some(yields) => yields.push(data),
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -865,10 +865,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// `&'name Ty` -> `&'name mut Ty` or `&Ty` -> `&mut Ty`
|
// `&'name Ty` -> `&'name mut Ty` or `&Ty` -> `&mut Ty`
|
||||||
vec![(
|
vec![(
|
||||||
ty_ref.1.ty.span.shrink_to_lo(),
|
ty_ref.1.ty.span.shrink_to_lo(),
|
||||||
format!(
|
format!("{}mut ", if ty_ref.0.ident.span.is_empty() { "" } else { " " },),
|
||||||
"{}mut ",
|
|
||||||
if ty_ref.0.ident.span.lo() == ty_ref.0.ident.span.hi() { "" } else { " " },
|
|
||||||
),
|
|
||||||
)]
|
)]
|
||||||
};
|
};
|
||||||
sugg.extend([
|
sugg.extend([
|
||||||
|
|
|
@ -1655,7 +1655,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
||||||
// `&'name Ty` -> `&'name mut Ty` or `&Ty` -> `&mut Ty`
|
// `&'name Ty` -> `&'name mut Ty` or `&Ty` -> `&mut Ty`
|
||||||
Some(mut_ty.ty.span.shrink_to_lo())
|
Some(mut_ty.ty.span.shrink_to_lo())
|
||||||
};
|
};
|
||||||
let pre = if lt.ident.span.lo() == lt.ident.span.hi() { "" } else { " " };
|
let pre = if lt.ident.span.is_empty() { "" } else { " " };
|
||||||
Some(errors::UnusedAssignSuggestion {
|
Some(errors::UnusedAssignSuggestion {
|
||||||
ty_span,
|
ty_span,
|
||||||
pre,
|
pre,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue