Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful suggestion for “remove the .await #101715

Closed
GoldsteinE opened this issue Sep 12, 2022 · 0 comments · Fixed by #101723
Closed

Unhelpful suggestion for “remove the .await #101715

GoldsteinE opened this issue Sep 12, 2022 · 0 comments · Fixed by #101723
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@GoldsteinE
Copy link
Contributor

GoldsteinE commented Sep 12, 2022

Given the following code (playground):

struct S;

impl S {
    fn very_long_method_name_the_longest_method_name_in_the_whole_universe(self) {}
}

async fn foo() {
    S.very_long_method_name_the_longest_method_name_in_the_whole_universe()
        .await
}

The current output is:

...
help: remove the `.await`
  |
8 -     S.very_long_method_name_the_longest_method_name_in_whole_universe()
8 +     S.very_long_method_name_the_longest_method_name_in_whole_universe()
  |

Ideally the output should look like:

...
help: remove the `.await`
  |
9 -         .await
  |

It’s reproducible on playground’s latest stable, beta and nightly (1.63.0, 1.64.0-beta.6 and 1.65.0-nightly (2022-09-11 59e7a30)) respectively.

Possibly related to #94877?

@GoldsteinE GoldsteinE added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 12, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 12, 2022
…errors

Impove diagnostic for `.await`ing non-futures

Strip leading whitespace from the span and use a non-verbose suggestion.
fixes rust-lang#101715
@bors bors closed this as completed in 8dc4b26 Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant