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 to add lifetime constraint at explicit ouput of functions #65730

Merged
merged 3 commits into from
Nov 21, 2019

Conversation

csmoe
Copy link
Member

@csmoe csmoe commented Oct 23, 2019

Closes #62097

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(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 Oct 23, 2019
@petrochenkov
Copy link
Contributor

r? @nikomatsakis for review or reassignment

@csmoe csmoe changed the title Suggest to add lifetime constraint expect asyn-fn without explicit output Suggest to add lifetime constraint at explicit ouput of functions Oct 29, 2019
@csmoe csmoe marked this pull request as ready for review October 29, 2019 09:26
@rust-highfive

This comment has been minimized.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Looks good! One suggestion

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Looks great!

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 1, 2019

📌 Commit 2f98759c76a7f292970ed7b225821f6b788605c2 has been approved by nikomatsakis

@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 Nov 1, 2019
@bors
Copy link
Contributor

bors commented Nov 1, 2019

⌛ Testing commit 2f98759c76a7f292970ed7b225821f6b788605c2 with merge eef9c0cfb310ce550148cae4a85572d834740416...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-nopt of your PR failed (pretty log, 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-11-01T16:58:05.5135176Z 
2019-11-01T16:58:05.5135721Z ---- [ui (nll)] ui/async-await/issues/issue-62097.rs stdout ----
2019-11-01T16:58:05.5135824Z diff of stderr:
2019-11-01T16:58:05.5135867Z 
2019-11-01T16:58:05.5136124Z - error: cannot infer an appropriate lifetime
2019-11-01T16:58:05.5136548Z -   --> $DIR/issue-62097.rs:12:31
2019-11-01T16:58:05.5136775Z + error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function
2019-11-01T16:58:05.5137093Z +   --> $DIR/issue-62097.rs:13:13
2019-11-01T16:58:05.5137189Z 3    |
2019-11-01T16:58:05.5137422Z - LL |     pub async fn run_dummy_fn(&self) {
2019-11-01T16:58:05.5137666Z -    |                               ^^^^^ ...but this borrow...
2019-11-01T16:58:05.5137892Z 6 LL |         foo(|| self.bar()).await;
2019-11-01T16:58:05.5138208Z -    |         --- this return type evaluates to the `'static` lifetime...
2019-11-01T16:58:05.5138583Z +    |             ^^ ---- `self` is borrowed here
2019-11-01T16:58:05.5138878Z +    |             may outlive borrowed value `self`
2019-11-01T16:58:05.5138954Z 8    |
2019-11-01T16:58:05.5138954Z 8    |
2019-11-01T16:58:05.5139335Z - note: ...can't outlive the lifetime `'_` as defined on the method body at 12:31
2019-11-01T16:58:05.5139883Z -   --> $DIR/issue-62097.rs:12:31
2019-11-01T16:58:05.5140286Z + note: function requires argument type to outlive `'static`
2019-11-01T16:58:05.5140651Z +   --> $DIR/issue-62097.rs:13:9
2019-11-01T16:58:05.5140848Z 11    |
2019-11-01T16:58:05.5140953Z + LL |         foo(|| self.bar()).await;
2019-11-01T16:58:05.5141015Z +    |         ^^^^^^^^^^^^^^^^^^
2019-11-01T16:58:05.5141217Z + help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword
2019-11-01T16:58:05.5141323Z +    |
2019-11-01T16:58:05.5141413Z + LL |         foo(move || self.bar()).await;
2019-11-01T16:58:05.5141567Z + 
2019-11-01T16:58:05.5141741Z + error[E0521]: borrowed data escapes outside of function
2019-11-01T16:58:05.5142017Z +   --> $DIR/issue-62097.rs:13:9
2019-11-01T16:58:05.5142097Z +    |
2019-11-01T16:58:05.5142097Z +    |
2019-11-01T16:58:05.5142288Z 12 LL |     pub async fn run_dummy_fn(&self) {
2019-11-01T16:58:05.5142560Z -    |                               ^
2019-11-01T16:58:05.5143000Z +    |                               ----- `self` is a reference that is only valid in the function body
2019-11-01T16:58:05.5143537Z + LL |         foo(|| self.bar()).await;
2019-11-01T16:58:05.5143933Z +    |         ^^^^^^^^^^^^^^^^^^ `self` escapes the function body here
2019-11-01T16:58:05.5144332Z - error: aborting due to previous error
2019-11-01T16:58:05.5144725Z + error: aborting due to 2 previous errors
2019-11-01T16:58:05.5144827Z 16 
2019-11-01T16:58:05.5145129Z + For more information about this error, try `rustc --explain E0373`.
2019-11-01T16:58:05.5145129Z + For more information about this error, try `rustc --explain E0373`.
2019-11-01T16:58:05.5145341Z 17 
2019-11-01T16:58:05.5145442Z 
2019-11-01T16:58:05.5145494Z 
2019-11-01T16:58:05.5145592Z The actual stderr differed from the expected stderr.
2019-11-01T16:58:05.5145996Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/async-await/issues/issue-62097.nll/issue-62097.nll.stderr
2019-11-01T16:58:05.5146425Z To update references, rerun the tests and pass the `--bless` flag
2019-11-01T16:58:05.5147070Z To only update this specific test, also pass `--test-args async-await/issues/issue-62097.rs`
2019-11-01T16:58:05.5147564Z error: 1 errors occurred comparing output.
2019-11-01T16:58:05.5148012Z status: exit code: 1
2019-11-01T16:58:05.5148012Z status: exit code: 1
2019-11-01T16:58:05.5149128Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/async-await/issues/issue-62097.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/async-await/issues/issue-62097.nll" "-Zborrowck=mir" "-Crpath" "-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/async-await/issues/issue-62097.nll/auxiliary" "-A" "unused"
2019-11-01T16:58:05.5149900Z ------------------------------------------
2019-11-01T16:58:05.5150068Z 
2019-11-01T16:58:05.5150555Z ------------------------------------------
2019-11-01T16:58:05.5150761Z stderr:
2019-11-01T16:58:05.5150761Z stderr:
2019-11-01T16:58:05.5151203Z ------------------------------------------
2019-11-01T16:58:05.5151761Z error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function
2019-11-01T16:58:05.5152106Z   --> /checkout/src/test/ui/async-await/issues/issue-62097.rs:13:13
2019-11-01T16:58:05.5152298Z    |
2019-11-01T16:58:05.5152389Z LL |         foo(|| self.bar()).await;
2019-11-01T16:58:05.5152645Z    |             ^^ ---- `self` is borrowed here
2019-11-01T16:58:05.5152941Z    |             may outlive borrowed value `self`
2019-11-01T16:58:05.5153000Z    |
2019-11-01T16:58:05.5153364Z note: function requires argument type to outlive `'static`
2019-11-01T16:58:05.5153753Z   --> /checkout/src/test/ui/async-await/issues/issue-62097.rs:13:9
2019-11-01T16:58:05.5153753Z   --> /checkout/src/test/ui/async-await/issues/issue-62097.rs:13:9
2019-11-01T16:58:05.5153951Z    |
2019-11-01T16:58:05.5154040Z LL |         foo(|| self.bar()).await;
2019-11-01T16:58:05.5154119Z    |         ^^^^^^^^^^^^^^^^^^
2019-11-01T16:58:05.5154252Z help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword
2019-11-01T16:58:05.5154338Z    |
2019-11-01T16:58:05.5154406Z LL |         foo(move || self.bar()).await;
2019-11-01T16:58:05.5154524Z 
2019-11-01T16:58:05.5154579Z error[E0521]: borrowed data escapes outside of function
2019-11-01T16:58:05.5154999Z   --> /checkout/src/test/ui/async-await/issues/issue-62097.rs:13:9
2019-11-01T16:58:05.5155086Z    |
2019-11-01T16:58:05.5155086Z    |
2019-11-01T16:58:05.5155143Z LL |     pub async fn run_dummy_fn(&self) { //~ ERROR cannot infer
2019-11-01T16:58:05.5155581Z    |                               ----- `self` is a reference that is only valid in the function body
2019-11-01T16:58:05.5155778Z LL |         foo(|| self.bar()).await;
2019-11-01T16:58:05.5155886Z    |         ^^^^^^^^^^^^^^^^^^ `self` escapes the function body here
2019-11-01T16:58:05.5156028Z error: aborting due to 2 previous errors
2019-11-01T16:58:05.5156066Z 
2019-11-01T16:58:05.5156762Z For more information about this error, try `rustc --explain E0373`.
2019-11-01T16:58:05.5156927Z 
---
2019-11-01T16:58:05.5185258Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-01T16:58:05.5185350Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-01T16:58:05.5198939Z 
2019-11-01T16:58:05.5199010Z 
2019-11-01T16:58:05.5208964Z 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" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--host-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -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" "--llvm-version" "9.0.0-rust-1.40.0-dev\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always" "--compare-mode" "nll"
2019-11-01T16:58:05.5209608Z 
2019-11-01T16:58:05.5209642Z 
2019-11-01T16:58:05.5213292Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-11-01T16:58:05.5213827Z Build completed unsuccessfully in 1:41:31
2019-11-01T16:58:05.5213827Z Build completed unsuccessfully in 1:41:31
2019-11-01T16:58:05.5264050Z == clock drift check ==
2019-11-01T16:58:05.5282100Z   local time: Fri Nov  1 16:58:05 UTC 2019
2019-11-01T16:58:05.8050040Z   network time: Fri, 01 Nov 2019 16:58:05 GMT
2019-11-01T16:58:05.8050248Z == end clock drift check ==
2019-11-01T16:58:06.8586814Z 
2019-11-01T16:58:06.8693187Z ##[error]Bash exited with code '1'.
2019-11-01T16:58:06.8730912Z ##[section]Starting: Checkout
2019-11-01T16:58:06.8733720Z ==============================================================================
2019-11-01T16:58:06.8733838Z Task         : Get sources
2019-11-01T16:58:06.8734152Z 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)

@bors
Copy link
Contributor

bors commented Nov 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 Nov 1, 2019
@csmoe
Copy link
Member Author

csmoe commented Nov 2, 2019

r=@nikomatsakis

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 8, 2019

📌 Commit 1adb26b has been approved by nikomatsakis

@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 Nov 8, 2019
@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, 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.

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 Nov 20, 2019

⌛ Testing commit 9124f7a with merge 873671bceeda26a9a73140d8791812a3bcb85e7b...

@Centril
Copy link
Contributor

Centril commented Nov 20, 2019

@bors retry in r0llup

@bors
Copy link
Contributor

bors commented Nov 20, 2019

⌛ Testing commit 9124f7a with merge 33887d5c8537a53c3c3ecf1ef096b1a77b6a82f2...

@bors
Copy link
Contributor

bors commented Nov 20, 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 Nov 20, 2019
@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, 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.

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)

@Centril
Copy link
Contributor

Centril commented Nov 21, 2019

@bors retry spurious network

@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 Nov 21, 2019
@bors
Copy link
Contributor

bors commented Nov 21, 2019

⌛ Testing commit 9124f7a with merge eecdf9d7ee82d1d1d0a2413d8d80183a2c5e036e...

Centril added a commit to Centril/rust that referenced this pull request Nov 21, 2019
Suggest to add lifetime constraint at explicit ouput of functions

Closes rust-lang#62097
@Centril
Copy link
Contributor

Centril commented Nov 21, 2019

@bors retry rolled up.

@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, 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-11-21T10:06:25.5405174Z  35  480M   35  168M    0     0  25.6M      0  0:00:18  0:00:06  0:00:12 26.9M
2019-11-21T10:06:26.8194781Z  38  480M   38  186M    0     0  24.5M      0  0:00:19  0:00:07  0:00:12 25.7M
2019-11-21T10:06:26.8806083Z  44  480M   44  212M    0     0  23.6M      0  0:00:20  0:00:09  0:00:11 23.7M
2019-11-21T10:06:26.8817848Z  44  480M   44  214M    0     0  23.7M      0  0:00:20  0:00:09  0:00:11 23.0M
2019-11-21T10:06:26.8818712Z curl: (56) OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
2019-11-21T10:06:26.8844858Z 
2019-11-21T10:06:26.8845061Z gzip: stdin: unexpected end of file
2019-11-21T10:06:26.8851639Z tar: Unexpected EOF in archive
2019-11-21T10:06:26.8851738Z tar: Unexpected EOF in archive
2019-11-21T10:06:26.8851856Z tar: Error is not recoverable: exiting now
2019-11-21T10:06:26.8897865Z 
2019-11-21T10:06:26.8967975Z ##[error]Bash exited with code '2'.
2019-11-21T10:06:26.9168475Z ##[section]Starting: Checkout
2019-11-21T10:06:26.9261634Z ==============================================================================
2019-11-21T10:06:26.9261707Z Task         : Get sources
2019-11-21T10:06:26.9261781Z 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)

Centril added a commit to Centril/rust that referenced this pull request Nov 21, 2019
Suggest to add lifetime constraint at explicit ouput of functions

Closes rust-lang#62097
Centril added a commit to Centril/rust that referenced this pull request Nov 21, 2019
Suggest to add lifetime constraint at explicit ouput of functions

Closes rust-lang#62097
bors added a commit that referenced this pull request Nov 21, 2019
Rollup of 5 pull requests

Successful merges:

 - #65355 (Stabilize `!` in Rust 1.41.0)
 - #65730 (Suggest to add lifetime constraint at explicit ouput of functions)
 - #66468 (Cleanup Miri SIMD intrinsics)
 - #66515 (Reduce size of `hir::Expr` by boxing more of `hir::InlineAsm`)
 - #66602 (Revert "Update Source Code Pro and include italics")

Failed merges:

r? @ghost
@bors bors merged commit 9124f7a into rust-lang:master Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

rustc suggests invalid syntax to fix lifetime inferring error
9 participants