lorri icon indicating copy to clipboard operation
lorri copied to clipboard

Migrate to clap 4.5

Open just1602 opened this issue 6 months ago • 0 comments

Hello,

This PR replace structopt with the latest clap version. For now it's building and all the test are passing using cargo build and cargo test, but when I try to run nix-build the clap_lex crate fail to build with the following error:

error: builder for '/nix/store/dpqi499fkpb0iz3rbckvci7nrh1f6vdc-rust_clap_lex-0.7.2.drv' failed with exit code 1;
       last 25 log lines:
       >     |
       > 235 |                 OsStr::from_encoded_bytes_unchecked(second),
       >     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `OsStr`
       >
       > error[E0599]: no method named `as_encoded_bytes` found for reference `&OsStr` in the current scope
       >    --> src/ext.rs:277:24
       >     |
       > 277 |         let bytes = os.as_encoded_bytes();
       >     |                        ^^^^^^^^^^^^^^^^ method not found in `&OsStr`
       >
       > error[E0599]: no function or associated item named `from_encoded_bytes_unchecked` found for struct `OsStr` in the current scope
       >    --> src/ext.rs:280:20
       >     |
       > 280 |             OsStr::from_encoded_bytes_unchecked(first),
       >     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `OsStr`
       >
       > error[E0599]: no function or associated item named `from_encoded_bytes_unchecked` found for struct `OsStr` in the current scope
       >    --> src/ext.rs:281:20
       >     |
       > 281 |             OsStr::from_encoded_bytes_unchecked(second),
       >     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `OsStr`
       >
       > error: aborting due to 11 previous errors
       >
       > For more information about this error, try `rustc --explain E0599`.
       For full logs, run 'nix log /nix/store/dpqi499fkpb0iz3rbckvci7nrh1f6vdc-rust_clap_lex-0.7.2.drv'.
error: 1 dependencies of derivation '/nix/store/xh0q0zr9c09k4fwf44px0c5g361xs10d-lorri.drv' failed to build

clap has a MSRV set at 1.74.0, and those functions were added in rust 1.74.0 so this should work since nixos 24.05 is using rust 1.77.2.

I think it's mainly a lack of nix experience and skill here. @nyarly if you have a couple of minutes, could you tell me if the rust version used to build this project is pinned to something older then 1.74.0, and or what would be the way to know which version of rust nix-build is using?

EDIT: I found it, nixpkgs were still pinned to 23.11. I update nix/update-nixpkgs.sh and run it. Now it builds :tada:

Fixes #105

  • [ ] Amended the changelog in release.nix (see release.nix for instructions)

just1602 avatar Aug 21 '24 18:08 just1602