1
Fork 0

Rollup merge of #101723 - lukas-code:await-diag, r=compiler-errors

Impove diagnostic for `.await`ing non-futures

Strip leading whitespace from the span and use a non-verbose suggestion.
fixes #101715
This commit is contained in:
Guillaume Gomez 2022-09-12 22:47:15 +02:00 committed by GitHub
commit 8dc4b26b60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 17 deletions

View file

@ -1160,8 +1160,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
// and if not maybe suggest doing something else? If we kept the expression around we
// could also check if it is an fn call (very likely) and suggest changing *that*, if
// it is from the local crate.
err.span_suggestion_verbose(
expr.span.shrink_to_hi().with_hi(span.hi()),
err.span_suggestion(
span,
"remove the `.await`",
"",
Applicability::MachineApplicable,