diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-27 23:01:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-27 23:01:01 +0200 |
| commit | df97fc6038c648ce7396d3f4dde6f6d783aec1ba (patch) | |
| tree | 7a86dc790708086050272878dcfed6efa7741f4e /src/rustllvm/RustWrapper.cpp | |
| parent | 2f6cf36b326d5045872785782cdd0c121a3198ec (diff) | |
| parent | 88194200e57c90ba0fa7b725d63ff4de28e71bbb (diff) | |
| download | rust-df97fc6038c648ce7396d3f4dde6f6d783aec1ba.tar.gz rust-df97fc6038c648ce7396d3f4dde6f6d783aec1ba.zip | |
Rollup merge of #62067 - doctorn:await_diagnostic, r=matthewjasper
Add suggestion for missing `.await` keyword
This commit adds a suggestion diagnostic for missing `.await`. In order to do this, the trait `Future` is promoted to a lang item.
Compiling code of the form:
```rust
#![feature(async_await)]
fn take_u32(x: u32) {}
async fn make_u32() -> u32 {
22
}
async fn foo() {
let x = make_u32();
take_u32(x)
}
fn main() {}
```
Will now result in the suggestion:
```
error[E0308]: mismatched types
--> src/main.rs:11:18
|
11 | take_u32(x)
| ^
| |
| expected u32, found opaque type
| help: consider using `.await` here: `x.await`
|
= note: expected type `u32`
found type `impl std::future::Future`
```
This commit does not cover chained expressions and therefore only covers the case originally pointed out in #61076. Cases I can think of that still need to be covered:
- [ ] Return places for functions
- [ ] Field access
- [ ] Method invocation
I'm planning to submit PRs for each of these separately as and when I have figured them out.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
