6

Tweak errors coming from `for`-loop, `?` and `.await` desugaring by estebank · P...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/90939
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

estebank commented on Nov 16, 2021

edited
  • 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 #66731.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK