-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
193 changed files
with
1,317 additions
and
2,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.