ordinals / ord

👁‍🗨 Rare and exotic sats
https://ordinals.com
Creative Commons Zero v1.0 Universal
3.86k stars 1.38k forks source link

unable to build 0.21.3 for Windows - temporary value dropped while borrowed #4073

Closed cryptoni9n closed 1 week ago

cryptoni9n commented 1 week ago

receiving these errors when trying to cargo build --release from git branch 0.21.3:

error[E0716]: temporary value dropped while borrowed                                                                                                               
  --> src\subcommand\verify.rs:35:8
   |
34 |       } else if let Some(file) = &self.file {
   |  ____________-
35 | |       &fs::read(file)?
   | |        ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
36 | |     } else {
   | |     - temporary value is freed at the end of this statement
37 | |       unreachable!()
38 | |     };
   | |_____- borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
  --> src\subcommand\wallet\sign.rs:38:8
   |
37 |       } else if let Some(file) = &self.file {
   |  ____________-
38 | |       &fs::read(file)?
   | |        ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
39 | |     } else {
   | |     - temporary value is freed at the end of this statement
40 | |       unreachable!()
41 | |     };
   | |_____- 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 `ord` (lib) due to 2 previous errors
so7ow commented 1 week ago

For whatever it's worth: works fine for me on Ubuntu with rustc v1.82. Got current/recent rust toolkit?

$ rustc --version
rustc 1.82.0 (f6e511eec 2024-10-15)

Perhaps an undocumented dependency update?

dcorral commented 1 week ago

I had the same issue with rustc 1.77.2, upgrading to rustc 1.82.0 fixes this.

rustup upgrade
cargo clean
cargo build --release
cryptoni9n commented 1 week ago

For whatever it's worth: works fine for me on Ubuntu with rustc v1.82. Got current/recent rust toolkit?

$ rustc --version
rustc 1.82.0 (f6e511eec 2024-10-15)

thanks @so7ow - you are correct. I was on 1.77.0 and was only able to build successfully after upgrading to 1.82.0.

@raphjaph I think Cargo.toml needs to have the rust-version updated. I can make the PR if that is all there is to it?

raphjaph commented 1 week ago

Thanks good catch! https://github.com/ordinals/ord/issues/4073

so7ow commented 1 week ago

README.md mentions the wrong version, too