diff options
| author | bors <bors@rust-lang.org> | 2019-09-01 18:04:49 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-01 18:04:49 +0000 | 
| commit | dfd43f0fdd4e6969c7d82c0670d70bf305fbccf8 (patch) | |
| tree | 31a87971a84ffc967645099773910d6498d0cb0b /src/libsyntax/parse/parser/expr.rs | |
| parent | e29faf0d095a51f5a06cfc6208a914b13481e1fe (diff) | |
| parent | e5530519502baf3ae37fa94eda27c2461d8c94aa (diff) | |
| download | rust-dfd43f0fdd4e6969c7d82c0670d70bf305fbccf8.tar.gz rust-dfd43f0fdd4e6969c7d82c0670d70bf305fbccf8.zip | |
Auto merge of #63870 - estebank:async-fn-call, r=oli-obk
Suggest call fn ctor passed as arg to fn with type param bounds
_Reviewer note: the relevant changes are in the second commit, the first is simple and mechanical, but verbose._
When forgetting to call a fn in an argument position to an fn that has a generic bound:
```rust
async fn foo() {}
fn bar(f: impl Future<Output=()>) {}
fn main() {
    bar(foo); // <- should be `bar(foo());`
}
```
suggest calling it:
```
error[E0277]: the trait bound `fn() -> impl std::future::Future {foo}: std::future::Future` is not satisfied
  --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:9:5
   |
LL | fn bar(f: impl Future<Output=()>) {}
   | --------------------------------- required by `bar`
...
LL |     bar(foo);
   |     ^^^ the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}`
   |
   = help: it looks like you forgot to use parentheses to call the function: `foo()`
```
Fix #63100. Follow up to #63833 and #63337.
Diffstat (limited to 'src/libsyntax/parse/parser/expr.rs')
0 files changed, 0 insertions, 0 deletions
