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

cargo dist fails to compile from source with rust 1.78.0 #1204

Closed
rob-p opened this issue Jul 12, 2024 · 9 comments
Closed

cargo dist fails to compile from source with rust 1.78.0 #1204

rob-p opened this issue Jul 12, 2024 · 9 comments

Comments

@rob-p
Copy link

rob-p commented Jul 12, 2024

I get the following error when installing via cargo install cargo-dist

error[E0716]: temporary value dropped while borrowed
   --> /home/XXX/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-dist-0.19.0/src/init.rs:882:10
    |
873 |     let install_path = if install_path.is_none()
    |         ------------ borrow later stored here
...
882 |         &Some(InstallPathStrategy::default_list())
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
883 |     } else {
    |     - temporary value is freed at the end of this statement
    |
    = 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 `cargo-dist` (lib) due to 1 previous error
error: failed to compile `cargo-dist v0.19.0`, intermediate artifacts can be found at `/mnt/scratch1/XXX/cargo-installyt5WVA`.

is 1.78.0 a supported Rust version?

@Gankra
Copy link
Contributor

Gankra commented Jul 12, 2024

I can reproduce this and yes 1.78.0 should be fine. I am both shocked that rustc randomly changed borrow semantics and that we accidentally rammed into it.

@rob-p
Copy link
Author

rob-p commented Jul 12, 2024

Yes; I am also shocked that such a seemingly obviously breaking change was made not on an edition boundary! I don't think it's documented anywhere...

@Gankra
Copy link
Contributor

Gankra commented Jul 12, 2024

It's not a breaking change, the compiler got strictly better at compiling things in 1.79.0 and all of us updated our toolchains before landing the code change that randomly depended on it.

@rob-p
Copy link
Author

rob-p commented Jul 12, 2024

Perhaps my terminology isn't correct. What I mean is I'm surprised they altered the behavior in such a way not on a major boundary without announcing it. I realize it's not breaking in the sense that something that doesn't compile with 1.78 will compile with 1.79 and not vice versa... but still I feel like this is a change worth mentioning (perhaps I missed in the release notes though).

@Gankra
Copy link
Contributor

Gankra commented Jul 12, 2024

https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html#extending-automatic-temporary-lifetime-extension

@rob-p
Copy link
Author

rob-p commented Jul 12, 2024

I was just reading :) — I did indeed miss this as in 1.79 I was pretty much concerned only with this.

@Gankra
Copy link
Contributor

Gankra commented Jul 12, 2024

I'll have a patch release out in like 30 mins once tests pass

@rob-p
Copy link
Author

rob-p commented Jul 12, 2024

Awesome; thanks for the super-quick fix!

@Gankra
Copy link
Contributor

Gankra commented Jul 12, 2024

published

@Gankra Gankra closed this as completed Jul 12, 2024
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

2 participants