-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix await suggestion on non-future type #90933
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
a03966c
to
d0d6f64
Compare
Fixed up the error to only suggest on |
I would expect the output for the test case to be
Looking at the name of the bindings, it looks like this should have been working correctly, but it's possible that the span being passed in was incorrect in the first place. I think that where you changed the code, you need to look to see if you can get a rust/compiler/rustc_infer/src/infer/error_reporting/mod.rs Lines 601 to 604 in 3d29b68
rust/compiler/rustc_infer/src/infer/error_reporting/mod.rs Lines 646 to 657 in 3d29b68
I would make it a Would you be able to try that out and see if I'm right? |
d0d6f64
to
c89fd7d
Compare
I applied the changes you asked for, I think! Let me know if I did it wrong. I also removed the |
The changes look reasonable. Can you add test cases covering all the new codepaths? Adding them to |
c89fd7d
to
d613ae7
Compare
d613ae7
to
fc816c3
Compare
@bors r+ |
📌 Commit fc816c3 has been approved by |
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#90733 (Build musl dist artifacts with debuginfo enabled) - rust-lang#90787 (Add `#[inline]`s to `SortedIndexMultiMap`) - rust-lang#90920 (:arrow_up: rust-analyzer) - rust-lang#90933 (Fix await suggestion on non-future type) - rust-lang#90935 (Alphabetize language features) - rust-lang#90949 (update miri) - rust-lang#90958 (Mark `<*const _>::align_offset` and `<*mut _>::align_offset` as `const fn`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Remove a match block that would suggest to add
.await
in the case where the expected type'sFuture::Output
equals the found type. We only want to suggest.await
ing in the opposite case (the found type'sFuture::Output
equals the expected type).The code sample is here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6ba6b83d4dddda263553b79dca9f6bcb
Before:
After:
Fixes #90931