#Updating tokio v1.38.1 -> v1.39.1 and tokio-macros v2.3.0 -> v2.4.0 breaks build

3 messages · Page 1 of 1 (latest)

broken bronze
#
    Updating crates.io index
     Locking 3 packages to latest compatible versions                                                                             Adding mio v1.0.1
    Removing num_cpus v1.16.0                                                                                                   Updating tokio v1.38.1 -> v1.39.1
    Updating tokio-macros v2.3.0 -> v2.4.0

After doing this I am getting:

error[E0716]: temporary value dropped while borrowed
   --> C:\Users\J\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ezsockets-0.6.2\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

... in library code.

I have a dependency on latest bevy_simplenet (0.12), which pulls in ezsockets, which depends on tokio (1.17.0).

I'd like to be able to do cargo update without having to cherry-pick which specific packages I update, without having my build break.

I'd also like to understand more about whether I'm doing something wrong, are some of my implicit assumptions that cargo update should not break build wrong, or if it's the libraries who aren't doing semver properly, how to properly explain and report it.

summer thunder
#

This is most likely an accidental regression in tokio-macros. If you look at the expansion of this select, you get this:

// old
let mut futures = (
    (&mut sleep),
    (&mut abort_receiver.recv())
);

// new
let mut futures = (
    IntoFuture::into_future((&mut sleep)),
    IntoFuture::into_future((&mut abort_receiver.recv())),
);
```The old one uses temporary lifetime extension to keep the return of `abort_receiver.recv()` alive, but this doesn't work through function calls. This would be fixed by binding the futures to variables before calling `into_future` on them.

ezsockets shouldn't have used `&mut` here anyway though.
broken bronze
#

Thanks!