1
Fork 0

tweak removal span

This commit is contained in:
Michael Goulet 2023-04-25 19:02:55 +00:00
parent f0fc4f9acf
commit e6077fc1b8
2 changed files with 13 additions and 8 deletions

View file

@ -1596,8 +1596,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
// Peel off the DesugaringKind from the span
&& let Some(desugar_parent_span) = parent_expr.span.parent_callsite()
{
let removal_span = self.tcx
.sess
.source_map()
.span_extend_while(expr.span, char::is_whitespace)
.unwrap_or(expr.span)
.shrink_to_hi()
.to(desugar_parent_span);
err.span_suggestion(
self.tcx.sess.source.shrink_to_hi().to(desugar_parent_span),
removal_span,
"remove the `.await`",
"",
Applicability::MachineApplicable,