Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest call fn ctor passed as arg to fn with type param bounds #63870

Merged
merged 6 commits into from
Sep 1, 2019

Conversation

estebank
Copy link
Contributor

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:

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.

@rust-highfive
Copy link
Collaborator

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 24, 2019
@estebank
Copy link
Contributor Author

estebank commented Aug 24, 2019

Future work: keep accurate obligation spans for type bounds associated to specific fn arguments to point at the argument instead of the ident of the fn call. CC @oli-obk

@rust-highfive

This comment has been minimized.

@estebank
Copy link
Contributor Author

ping

LL | bar(foo);
| ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
|
= help: it looks like you forgot to use parentheses to call the function: `foo()`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case anyone is wondering why this is not a suggestion on foo's span: the error itself is already wrongly highlighting the bar function instead of its foo argument. That's a longstanding issue, but we have some ideas on how to continue with it.

@oli-obk
Copy link
Contributor

oli-obk commented Aug 30, 2019

@bors r+

r? @oli-obk

@bors
Copy link
Contributor

bors commented Aug 30, 2019

📌 Commit eb21c09edd79cb46625ca2f633dbe5fd7eee55b6 has been approved by oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned varkor Aug 30, 2019
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2019
@bors
Copy link
Contributor

bors commented Aug 30, 2019

⌛ Testing commit eb21c09edd79cb46625ca2f633dbe5fd7eee55b6 with merge 9e2c72f0c0fc8b9cc8c8dc738b1b92277fddcbc8...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-debug of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-08-30T17:52:18.6391341Z == clock drift check ==
2019-08-30T17:52:18.6413568Z   local time: Fri Aug 30 17:52:18 UTC 2019
2019-08-30T17:52:18.7239154Z   network time: Fri, 30 Aug 2019 17:52:18 GMT
2019-08-30T17:52:18.7242649Z == end clock drift check ==
2019-08-30T17:52:19.4176014Z ##[error]Bash exited with code '1'.
2019-08-30T17:52:19.4205891Z ##[section]Starting: Upload CPU usage statistics
2019-08-30T17:52:19.4239905Z ==============================================================================
2019-08-30T17:52:19.4240003Z Task         : Bash
2019-08-30T17:52:19.4240093Z Description  : Run a Bash script on macOS, Linux, or Windows

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Aug 30, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 30, 2019
@estebank
Copy link
Contributor Author

@bors retry

😅

2019-08-30T17:52:18.6413568Z   local time: Fri Aug 30 17:52:18 UTC 2019
2019-08-30T17:52:18.7239154Z   network time: Fri, 30 Aug 2019 17:52:18 GMT

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2019
@bors
Copy link
Contributor

bors commented Aug 31, 2019

⌛ Testing commit eb21c09edd79cb46625ca2f633dbe5fd7eee55b6 with merge 544cc59e7f4607dc9f061b849cef01a1fe4edba3...

@bors
Copy link
Contributor

bors commented Aug 31, 2019

💔 Test failed - checks-azure

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-debug of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-08-31T01:32:53.2278240Z == clock drift check ==
2019-08-31T01:32:53.2296243Z   local time: Sat Aug 31 01:32:53 UTC 2019
2019-08-31T01:32:53.3702526Z   network time: Sat, 31 Aug 2019 01:32:53 GMT
2019-08-31T01:32:53.3703135Z == end clock drift check ==
2019-08-31T01:32:54.1568886Z ##[error]Bash exited with code '1'.
2019-08-31T01:32:54.1597239Z ##[section]Starting: Upload CPU usage statistics
2019-08-31T01:32:54.1600286Z ==============================================================================
2019-08-31T01:32:54.1600365Z Task         : Bash
2019-08-31T01:32:54.1600445Z Description  : Run a Bash script on macOS, Linux, or Windows

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Sep 1, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 1, 2019
@estebank
Copy link
Contributor Author

estebank commented Sep 1, 2019

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 1, 2019
@estebank
Copy link
Contributor Author

estebank commented Sep 1, 2019

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Sep 1, 2019

📌 Commit ae93fa90a8f1d899372a0251dc6110f9b971cd1e has been approved by oli-obk

@bors
Copy link
Contributor

bors commented Sep 1, 2019

⌛ Testing commit ae93fa90a8f1d899372a0251dc6110f9b971cd1e with merge 4e180593b75b6fc0a1fb8ec6c3146ab6ef05b389...

@rust-highfive
Copy link
Collaborator

The job i686-apple of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-09-01T08:13:48.7066280Z ---- [ui] ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs stdout ----
2019-09-01T08:13:48.7066400Z diff of stderr:
2019-09-01T08:13:48.7066450Z 
2019-09-01T08:13:48.7066540Z 7 LL |     bar(foo);
2019-09-01T08:13:48.7067140Z 8    |     ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
2019-09-01T08:13:48.7067840Z -    = help: it looks like you forgot to use parentheses to call the function: `foo()`
2019-09-01T08:13:48.7067960Z +    = help: use parentheses to call the function: `foo()`
2019-09-01T08:13:48.7068040Z 11 
2019-09-01T08:13:48.7068120Z 12 error: aborting due to previous error
2019-09-01T08:13:48.7068120Z 12 error: aborting due to previous error
2019-09-01T08:13:48.7068190Z 13 
2019-09-01T08:13:48.7068250Z 
2019-09-01T08:13:48.7068290Z 
2019-09-01T08:13:48.7068370Z The actual stderr differed from the expected stderr.
2019-09-01T08:13:48.7069110Z Actual stderr saved to /Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
2019-09-01T08:13:48.7069750Z To update references, rerun the tests and pass the `--bless` flag
2019-09-01T08:13:48.7070670Z To only update this specific test, also pass `--test-args suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs`
2019-09-01T08:13:48.7070860Z error: 1 errors occurred comparing output.
2019-09-01T08:13:48.7070940Z status: exit code: 1
2019-09-01T08:13:48.7070940Z status: exit code: 1
2019-09-01T08:13:48.7072480Z command: "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/stage2/bin/rustc" "/Users/vsts/agent/2.155.1/work/1/s/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs" "-Zthreads=1" "--target=i686-apple-darwin" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/native/rust-test-helpers" "--edition=2018" "-L" "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called/auxiliary" "-A" "unused"
2019-09-01T08:13:48.7073440Z ------------------------------------------
2019-09-01T08:13:48.7073510Z 
2019-09-01T08:13:48.7074050Z ------------------------------------------
2019-09-01T08:13:48.7074140Z stderr:
2019-09-01T08:13:48.7074140Z stderr:
2019-09-01T08:13:48.7074670Z ------------------------------------------
2019-09-01T08:13:48.7075250Z error[E0277]: the trait bound `fn() -> impl T {foo}: T` is not satisfied
2019-09-01T08:13:48.7076020Z    |
2019-09-01T08:13:48.7076020Z    |
2019-09-01T08:13:48.7076100Z LL | fn bar(f: impl T<O=()>) {}
2019-09-01T08:13:48.7076750Z ...
2019-09-01T08:13:48.7076830Z LL |     bar(foo); //~ERROR E0277
2019-09-01T08:13:48.7076830Z LL |     bar(foo); //~ERROR E0277
2019-09-01T08:13:48.7077420Z    |     ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
2019-09-01T08:13:48.7077620Z    = help: use parentheses to call the function: `foo()`
2019-09-01T08:13:48.7077670Z 
2019-09-01T08:13:48.7077750Z error: aborting due to previous error
2019-09-01T08:13:48.7077800Z 
---
2019-09-01T08:13:48.7142710Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-09-01T08:13:48.7142890Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-09-01T08:13:48.7157870Z 
2019-09-01T08:13:48.7158350Z 
2019-09-01T08:13:48.7161190Z command did not execute successfully: "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/stage0-tools-bin/compiletest" "--compile-lib-path" "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/stage2/lib" "--run-lib-path" "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/stage2/lib/rustlib/i686-apple-darwin/lib" "--rustc-path" "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/stage2/bin/rustc" "--src-base" "/Users/vsts/agent/2.155.1/work/1/s/src/test/ui" "--build-base" "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/test/ui" "--stage-id" "stage2-i686-apple-darwin" "--mode" "ui" "--target" "i686-apple-darwin" "--host" "i686-apple-darwin" "--llvm-filecheck" "/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/llvm/build/bin/FileCheck" "--nodejs" "/usr/local/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/Users/vsts/agent/2.155.1/work/1/s/build/i686-apple-darwin/native/rust-test-helpers" "--docck-python" "/usr/local/bin/python2.7" "--lldb-python" "/usr/bin/python" "--lldb-version" "lldb-902.0.79.2\n  Swift-4.1\n" "--lldb-python-dir" "/Applications/Xcode_9.3.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python" "--llvm-version" "9.0.0-rust-1.39.0-dev\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-09-01T08:13:48.7162320Z 
2019-09-01T08:13:48.7162410Z 
2019-09-01T08:13:48.7171650Z failed to run: /Users/vsts/agent/2.155.1/work/1/s/build/bootstrap/debug/bootstrap test
2019-09-01T08:13:48.7171870Z Build completed unsuccessfully in 0:55:09
2019-09-01T08:13:48.7171870Z Build completed unsuccessfully in 0:55:09
2019-09-01T08:13:48.7272510Z == clock drift check ==
2019-09-01T08:13:48.7315190Z   local time: Sun Sep  1 08:13:48 UTC 2019
2019-09-01T08:13:48.8150040Z   network time: Sun, 01 Sep 2019 08:13:49 GMT
2019-09-01T08:13:48.8152720Z == end clock drift check ==
2019-09-01T08:13:48.8304940Z ##[error]Bash exited with code '1'.
2019-09-01T08:13:48.8345310Z ##[section]Starting: Upload CPU usage statistics
2019-09-01T08:13:48.8349520Z ==============================================================================
2019-09-01T08:13:48.8349620Z Task         : Bash
2019-09-01T08:13:48.8349760Z Description  : Run a Bash script on macOS, Linux, or Windows

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Sep 1, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 1, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-09-01T07:09:27.9695947Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-01T07:09:27.9905213Z ##[command]git config gc.auto 0
2019-09-01T07:09:27.9984826Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-01T07:09:28.0406529Z ##[command]git config --get-all http.proxy
2019-09-01T07:09:28.0593533Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/63870/merge:refs/remotes/pull/63870/merge
---
2019-09-01T08:15:28.9575830Z .................................................................................................... 1500/8985
2019-09-01T08:15:34.9185075Z .................................................................................................... 1600/8985
2019-09-01T08:15:48.2336224Z .................................................i...............i.................................. 1700/8985
2019-09-01T08:15:56.8032010Z .................................................................................................... 1800/8985
2019-09-01T08:16:11.7290660Z ........................................iiiii....................................................... 1900/8985
2019-09-01T08:16:23.0793184Z .................................................................................................... 2100/8985
2019-09-01T08:16:25.7948224Z .................................................................................................... 2200/8985
2019-09-01T08:16:30.0866317Z .................................................................................................... 2300/8985
2019-09-01T08:16:38.0564628Z .................................................................................................... 2400/8985
---
2019-09-01T08:19:44.6387349Z ...........................i...............i........................................................ 4700/8985
2019-09-01T08:19:57.2226318Z .................................................................................................... 4800/8985
2019-09-01T08:20:03.6950438Z .................................................................................................... 4900/8985
2019-09-01T08:20:14.8814000Z .................................................................................................... 5000/8985
2019-09-01T08:20:20.7723023Z ........ii.ii....................................................................................... 5100/8985
2019-09-01T08:20:34.4019170Z .................................................................................................... 5300/8985
2019-09-01T08:20:42.9534451Z .......................................................................i............................ 5400/8985
2019-09-01T08:20:50.5328713Z .................................................................................................... 5500/8985
2019-09-01T08:20:57.6348762Z .................................................................................................... 5600/8985
2019-09-01T08:20:57.6348762Z .................................................................................................... 5600/8985
2019-09-01T08:21:08.7247455Z .................................................................ii...i..ii...........i............. 5700/8985
2019-09-01T08:21:35.5311338Z .................................................................................................... 5900/8985
2019-09-01T08:21:45.1754373Z .................................................................................................... 6000/8985
2019-09-01T08:21:45.1754373Z .................................................................................................... 6000/8985
2019-09-01T08:21:51.4518923Z ..................................................................i..ii............................. 6100/8985
2019-09-01T08:22:21.7741695Z .................................................................................................... 6300/8985
2019-09-01T08:22:23.9601049Z .....................i.............................................................................. 6400/8985
2019-09-01T08:22:26.2842024Z .............................................................................................i...... 6500/8985
2019-09-01T08:22:29.1182016Z .................................................................................................... 6600/8985
---
2019-09-01T08:26:39.5783133Z ---- [ui] ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs stdout ----
2019-09-01T08:26:39.5783304Z diff of stderr:
2019-09-01T08:26:39.5783337Z 
2019-09-01T08:26:39.5783400Z 7 LL |     bar(foo);
2019-09-01T08:26:39.5783716Z 8    |     ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
2019-09-01T08:26:39.5784041Z -    = help: it looks like you forgot to use parentheses to call the function: `foo()`
2019-09-01T08:26:39.5784116Z +    = help: use parentheses to call the function: `foo()`
2019-09-01T08:26:39.5784172Z 11 
2019-09-01T08:26:39.5784216Z 12 error: aborting due to previous error
2019-09-01T08:26:39.5784216Z 12 error: aborting due to previous error
2019-09-01T08:26:39.5784273Z 13 
2019-09-01T08:26:39.5784301Z 
2019-09-01T08:26:39.5784327Z 
2019-09-01T08:26:39.5784372Z The actual stderr differed from the expected stderr.
2019-09-01T08:26:39.5784787Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
2019-09-01T08:26:39.5785065Z To update references, rerun the tests and pass the `--bless` flag
2019-09-01T08:26:39.5785612Z To only update this specific test, also pass `--test-args suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs`
2019-09-01T08:26:39.5785836Z error: 1 errors occurred comparing output.
2019-09-01T08:26:39.5785880Z status: exit code: 1
2019-09-01T08:26:39.5785880Z status: exit code: 1
2019-09-01T08:26:39.5786775Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called/auxiliary" "-A" "unused"
2019-09-01T08:26:39.5787293Z ------------------------------------------
2019-09-01T08:26:39.5787329Z 
2019-09-01T08:26:39.5787549Z ------------------------------------------
2019-09-01T08:26:39.5787613Z stderr:
2019-09-01T08:26:39.5787613Z stderr:
2019-09-01T08:26:39.5787832Z ------------------------------------------
2019-09-01T08:26:39.5788081Z error[E0277]: the trait bound `fn() -> impl T {foo}: T` is not satisfied
2019-09-01T08:26:39.5788581Z    |
2019-09-01T08:26:39.5788581Z    |
2019-09-01T08:26:39.5788625Z LL | fn bar(f: impl T<O=()>) {}
2019-09-01T08:26:39.5789263Z ...
2019-09-01T08:26:39.5789308Z LL |     bar(foo); //~ERROR E0277
2019-09-01T08:26:39.5789308Z LL |     bar(foo); //~ERROR E0277
2019-09-01T08:26:39.5789585Z    |     ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
2019-09-01T08:26:39.5789683Z    = help: use parentheses to call the function: `foo()`
2019-09-01T08:26:39.5789727Z 
2019-09-01T08:26:39.5789786Z error: aborting due to previous error
2019-09-01T08:26:39.5789818Z 
---
2019-09-01T08:26:39.5833369Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-09-01T08:26:39.5833482Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-09-01T08:26:39.5851795Z 
2019-09-01T08:26:39.5851919Z 
2019-09-01T08:26:39.5853906Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-09-01T08:26:39.5854327Z 
2019-09-01T08:26:39.5854358Z 
2019-09-01T08:26:39.5863978Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-09-01T08:26:39.5864348Z Build completed unsuccessfully in 1:09:46
2019-09-01T08:26:39.5864348Z Build completed unsuccessfully in 1:09:46
2019-09-01T08:26:39.5924594Z == clock drift check ==
2019-09-01T08:26:39.5938800Z   local time: Sun Sep  1 08:26:39 UTC 2019
2019-09-01T08:26:39.6788341Z   network time: Sun, 01 Sep 2019 08:26:39 GMT
2019-09-01T08:26:39.6791283Z == end clock drift check ==
2019-09-01T08:26:40.3868049Z ##[error]Bash exited with code '1'.
2019-09-01T08:26:40.3917093Z ##[section]Starting: Checkout
2019-09-01T08:26:40.3919511Z ==============================================================================
2019-09-01T08:26:40.3919595Z Task         : Get sources
2019-09-01T08:26:40.3919647Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@estebank
Copy link
Contributor Author

estebank commented Sep 1, 2019

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Sep 1, 2019

📌 Commit e553051 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 1, 2019
@bors
Copy link
Contributor

bors commented Sep 1, 2019

⌛ Testing commit e553051 with merge dfd43f0...

bors added a commit that referenced this pull request Sep 1, 2019
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.
@bors
Copy link
Contributor

bors commented Sep 1, 2019

☀️ Test successful - checks-azure
Approved by: oli-obk
Pushing dfd43f0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 1, 2019
@bors bors merged commit e553051 into rust-lang:master Sep 1, 2019
@estebank estebank deleted the async-fn-call branch November 9, 2023 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Try invoking the function" hint
9 participants