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

Updating to tokio-macros v2.4.0 leads to "creates a temporary value which is freed while still in use" error in src\socket.rs:631:22 #105

Closed
jurisk opened this issue Jul 24, 2024 · 4 comments

Comments

@jurisk
Copy link
Contributor

jurisk commented Jul 24, 2024

To reproduce - check out latest ezsockets, run build:

cargo test
[.. snip ..]
Compiling ezsockets v0.6.2 (C:\projects\others\ezsockets)                                                                                                                                                                                
   Compiling tinytemplate v1.2.1                                                                                                                                                                                                            
   Compiling criterion v0.4.0                                                                                                                                                                                                               
error[E0716]: temporary value dropped while borrowed                                                                                                                                                                                        
   --> src\socket.rs:631:22
    |
624 | /         tokio::select! {
625 | |             _ = &mut sleep => {
626 | |                 let Some(next_sleep_duration) = handle_heartbeat_sleep_elapsed(&sink, &config, &last_alive).await else {
627 | |                     break;
...   |
631 | |             _ = &mut abort_receiver.recv() => break,
    | |                      ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
632 | |         }
    | |         -
    | |         |
    | |_________temporary value is freed at the end of this statement
    |           borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value

For more information about this error, try `rustc --explain E0716`.                                                                                                                                                                         
error: could not compile `ezsockets` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

I think this is due to changes from tokio-macros v2.3.0 to v2.4.0.

@jurisk
Copy link
Contributor Author

jurisk commented Jul 26, 2024

Relates to tokio-rs/tokio#6722.

@jBernavaPrah
Copy link

Hi, same here.

@jurisk did you have a temporary fix?

@jurisk
Copy link
Contributor Author

jurisk commented Jul 26, 2024

Hi, same here.

@jurisk did you have a temporary fix?

I just held off on updating tokio for now in my project. I think tokio will also release a version without the breaking change, so either #106 or tokio-rs/tokio#6722 will fix this.

UkoeHB pushed a commit that referenced this issue Aug 2, 2024
Co-authored-by: Juris <jurisk@users.noreply.github.com>
@UkoeHB
Copy link
Collaborator

UkoeHB commented Aug 2, 2024

Fixed in #106. I'll ping @gbaranski to push a point release.

@UkoeHB UkoeHB closed this as completed Aug 2, 2024
UkoeHB pushed a commit to UkoeHB/ezsockets that referenced this issue Aug 2, 2024
Co-authored-by: Juris <jurisk@users.noreply.github.com>
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

No branches or pull requests

3 participants