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

Tokio-tls compile error #1546

Closed
Drevoed opened this issue Sep 11, 2019 · 4 comments · Fixed by #1547
Closed

Tokio-tls compile error #1546

Drevoed opened this issue Sep 11, 2019 · 4 comments · Fixed by #1547

Comments

@Drevoed
Copy link
Contributor

Drevoed commented Sep 11, 2019

Version

cargo tree | grep tokio                                                                   ░▒▓ at 13:18:40 
│   │   ├── tokio-codec v0.2.0-alpha.4
│   │   │   └── tokio-io v0.2.0-alpha.4
│   │   ├── tokio-io v0.2.0-alpha.4 (*)
│   │   └── tokio-sync v0.2.0-alpha.4
│   ├── tokio v0.2.0-alpha.4
│   │   ├── tokio-codec v0.2.0-alpha.4 (*)
│   │   ├── tokio-executor v0.2.0-alpha.4
│   │   │   ├── tokio-sync v0.2.0-alpha.4 (*)
│   │   ├── tokio-fs v0.2.0-alpha.4
│   │   │   ├── tokio-executor v0.2.0-alpha.4 (*)
│   │   │   ├── tokio-io v0.2.0-alpha.4 (*)
│   │   │   └── tokio-sync v0.2.0-alpha.4 (*)
│   │   ├── tokio-io v0.2.0-alpha.4 (*)
│   │   ├── tokio-macros v0.2.0-alpha.4
│   │   ├── tokio-net v0.2.0-alpha.4
│   │   │   ├── tokio-codec v0.2.0-alpha.4 (*)
│   │   │   ├── tokio-executor v0.2.0-alpha.4 (*)
│   │   │   ├── tokio-io v0.2.0-alpha.4 (*)
│   │   │   ├── tokio-sync v0.2.0-alpha.4 (*)
│   │   ├── tokio-sync v0.2.0-alpha.4 (*)
│   │   ├── tokio-timer v0.3.0-alpha.4
│   │   │   ├── tokio-executor v0.2.0-alpha.4 (*)
│   │   │   └── tokio-sync v0.2.0-alpha.4 (*)
│   ├── tokio-executor v0.2.0-alpha.4 (*)
│   ├── tokio-io v0.2.0-alpha.4 (*)
│   ├── tokio-net v0.2.0-alpha.4 (*)
│   ├── tokio-sync v0.2.0-alpha.4 (*)
│   ├── tokio-timer v0.3.0-alpha.4 (*)
│   │   ├── tokio-io v0.2.0-alpha.4 (*)
│   └── tokio v0.2.0-alpha.4 (*)
│   ├── tokio-io v0.2.0-alpha.4 (*)
│   └── tokio-tls v0.3.0-alpha.4
│       └── tokio-io v0.2.0-alpha.4 (*)
└── tokio v0.2.0-alpha.4 (*)

Platform

Linux arkrait 5.2.11-arch1-1-ARCH #1 SMP PREEMPT Thu Aug 29 08:09:36 UTC 2019 x86_64 GNU/Linux

Subcrates

tokio-tls

Description

When trying to compile tokio-tls with latest nightly (2019-09-10) compiler fails with

error[E0597]: `self` does not live long enough
   --> /home/miron/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-tls-0.3.0-alpha.4/src/lib.rs:305:23
    |
305 |         handshake(|s| self.0.accept(s), stream).await
    |         --------------^^^^---------------------
    |         |         |   |
    |         |         |   borrowed value does not live long enough
    |         |         value captured here
    |         a temporary with access to the borrow is created here ...
306 |     }
    |     -
    |     |
    |     `self` dropped here while still borrowed
    |     ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `impl std::future::Future`
    |
    = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
@fakeshadow
Copy link

add move in closure and it compiles on my machine.

@Drevoed
Copy link
Contributor Author

Drevoed commented Sep 11, 2019

Indeed that will work, but I suppose developers would like to see that the library in current state won't compile :)

@WaffleLapkin
Copy link
Contributor

Also, with the previous nightly (nightly-2019-09-10-x86_64-unknown-linux-gnu - rustc 1.39.0-nightly (0b36e9dea 2019-09-09)) tokio-tls compiles just fine.

@davidbarsky
Copy link
Member

I think this compilation error might be related to rust-lang/rust#64292.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants