amber-lang / amber

💎 Amber the programming language compiled to bash
https://amber-lang.com
GNU General Public License v3.0
3.75k stars 79 forks source link

[BUG] Update Rust in the Nix flake #299

Closed mks-h closed 1 month ago

mks-h commented 1 month ago

Describe the bug The master branch doesn't compile with the Rust version installed via nix develop. It reports an error on a single use of the new "Extending automatic temporary lifetime extension" feature of Rust 1.79.0.

The error:

Compiling amber v0.3.4-alpha (/var/home/mks/Projects/amber)
error[E0716]: temporary value dropped while borrowed
  --> src/modules/function/invocation_utils.rs:33:53
   |
33 |         let opt_argument = if max_args > min_args {&format!(" ({} optional)",max_args)} else {""};
   |             ------------                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
   |             |                                       |
   |             borrow later stored here                creates a temporary value which is freed while still in use
   |
   = note: consider using a `let` binding to create a longer lived value
   = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0716`.
error: could not compile `amber` (bin "amber" test) due to 1 previous error

To Reproduce

  1. Run nix develop
  2. Run cargo build
mks-h commented 1 month ago

Trying to update it for myself with nix flake update I only got rustc 1.78.0 (9b00956e5 2024-04-29) (built from a source tarball) version, which is still not new enough

b1ek commented 1 month ago

@brumik @8-sided-oregon can you take a look at this?

lxl66566 commented 1 month ago

Note that Naersk by default ignores the rust-toolchain file, using whatever Rust compiler version is present in nixpkgs. (naersk) and the rustc/cargo version in nixpkgs unstable is 1.78.