Tweak errors coming from for-loop, ? and .await desugaring#90939
Tweak errors coming from for-loop, ? and .await desugaring#90939bors merged 16 commits intorust-lang:masterfrom
for-loop, ? and .await desugaring#90939Conversation
|
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
r? @tmandry |
This comment has been minimized.
This comment has been minimized.
dc8ee04 to
7489b2a
Compare
This comment has been minimized.
This comment has been minimized.
7489b2a to
4897734
Compare
This comment has been minimized.
This comment has been minimized.
bd5d07b to
4ed0001
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
962cdeb to
c2f4f85
Compare
This comment has been minimized.
This comment has been minimized.
c2f4f85 to
e01210c
Compare
This comment has been minimized.
This comment has been minimized.
e01210c to
6db1f33
Compare
src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr
Outdated
Show resolved
Hide resolved
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
library/core/src/ops/try_trait.rs
Outdated
There was a problem hiding this comment.
Why are the changes in this file needed?
There was a problem hiding this comment.
I originally constrained these a lot to avoid false-positives, but given how the desugaring is applied, it wasn't necessary. But with the changes to the desugaring there were now some cases where we had TryBlock, but weren't coming from the method call (IIRC, we perform deduplication and a separate obligation ended up being selected for display). Removing the overspicificity fixed those regressions.
6db1f33 to
33da6f3
Compare
|
☔ The latest upstream changes (presumably #90737) made this pull request unmergeable. Please resolve the merge conflicts. |
99789d0 to
f2fc84f
Compare
|
@bors r=tmandry |
|
📌 Commit f2fc84f has been approved by |
|
⌛ Testing commit f2fc84f with merge f8b36190bdb8713600f13cc60289beffcfceeffc... |
|
💔 Test failed - checks-actions |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Failed due to a timeout. I guess.. @bors r+ rollup=sometimes |
|
💡 This pull request was already approved, no need to approve it again.
|
|
📌 Commit f2fc84f has been approved by |
|
@bors retry rollup=maybe |
|
@bors rollup=iffy |
Tweak errors coming from `for`-loop, `?` and `.await` desugaring
* Suggest removal of `.await` on non-`Future` expression
* Keep track of obligations introduced by desugaring
* Remove span pointing at method for obligation errors coming from desugaring
* Point at called local sync `fn` and suggest making it `async`
```
error[E0277]: `()` is not a future
--> $DIR/unnecessary-await.rs:9:10
|
LL | boo().await;
| -----^^^^^^ `()` is not a future
| |
| this call returns `()`
|
= help: the trait `Future` is not implemented for `()`
help: do not `.await` the expression
|
LL - boo().await;
LL + boo();
|
help: alternatively, consider making `fn boo` asynchronous
|
LL | async fn boo () {}
| +++++
```
Fix rust-lang#66731.
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring) - rust-lang#91859 (Iterator::cycle() — document empty iterator special case) - rust-lang#91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`) - rust-lang#91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking) - rust-lang#91881 (Stabilize `iter::zip`) - rust-lang#91882 (Remove `in_band_lifetimes` from `rustc_typeck`) - rust-lang#91940 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Tweak errors coming from `for`-loop, `?` and `.await` desugaring
* Suggest removal of `.await` on non-`Future` expression
* Keep track of obligations introduced by desugaring
* Remove span pointing at method for obligation errors coming from desugaring
* Point at called local sync `fn` and suggest making it `async`
```
error[E0277]: `()` is not a future
--> $DIR/unnecessary-await.rs:9:10
|
LL | boo().await;
| -----^^^^^^ `()` is not a future
| |
| this call returns `()`
|
= help: the trait `Future` is not implemented for `()`
help: do not `.await` the expression
|
LL - boo().await;
LL + boo();
|
help: alternatively, consider making `fn boo` asynchronous
|
LL | async fn boo () {}
| +++++
```
Fix rust-lang#66731.
.awaiton non-Futureexpressionfnand suggest making itasyncFix #66731.