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,

View File

@ -1,13 +1,11 @@
error[E0277]: `()` is not a future
--> $DIR/issue-101715.rs:11:10
|
LL | S.very_long_method_name_the_longest_method_name_in_the_whole_universe()
| ____________________________________________________________________________-
LL | | .await
| | ^^^^-
| |__________|___|
| | help: remove the `.await`
| `()` is not a future
LL | .await
| -^^^^^
| ||
| |`()` is not a future
| help: remove the `.await`
|
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited