hakoerber / git-repo-manager

A git tool to manage worktrees and integrate with GitHub and GitLab
https://hakoerber.github.io/git-repo-manager/
GNU General Public License v3.0
62 stars 9 forks source link

build doesn't work with latest nightly? #57

Closed colemickens closed 2 months ago

colemickens commented 1 year ago

Hi! I'm trying to build this with nix to test it out for a couple of fun scenarios/ideas.

I'm hitting this when building, with what I think is latest nightly:

git-repo-manager-unstable> error[E0015]: cannot call non-const fn `std::option::Option::<&str>::unwrap_or` in constants
git-repo-manager-unstable>   --> src/provider/github.rs:13:39
git-repo-manager-unstable>    |
git-repo-manager-unstable> 13 |     option_env!("GITHUB_API_BASEURL").unwrap_or("https://api.github.com");
git-repo-manager-unstable>    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
git-repo-manager-unstable>    |
git-repo-manager-unstable>    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
git-repo-manager-unstable> error[E0015]: cannot call non-const fn `std::option::Option::<&str>::unwrap_or` in constants
git-repo-manager-unstable>   --> src/provider/gitlab.rs:12:68
git-repo-manager-unstable>    |
git-repo-manager-unstable> 12 | const GITLAB_API_BASEURL: &str = option_env!("GITLAB_API_BASEURL").unwrap_or("https://gitlab.com");
git-repo-manager-unstable>    |                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
git-repo-manager-unstable>    |
git-repo-manager-unstable>    = note: calls in constants are limited to constant functions, tuple structs and tuple variants

and if I nix derivation show ${grm} | grep rust-nightly-minimal then I see amongst the output:

/nix/store/6a1h550mcqhm12m7x8cbs6bs6qmbm7qy-rust-nightly-minimal-2023-04-28.drv

Any advice? Or if you know the last nightly that worked I might be able to pin it for now, I don't think it's recorded in the repo.

hakoerber commented 1 year ago

Hey,

I can reproduce the issue on my side. It looks like the const_option_ext feature (link) changed, I have honestly no idea why it stopped working, there was no change.

Anyway, I found a workaround using match on the Option instead of using unwrap_or(). I'll push that as soon as the tests pass.

Out of interest, I'll try to bisect the last working nightly.

hakoerber commented 1 year ago

Hey, I just pushed the fix. Builds for me with the current nightly (nightly-2023-05-04-x86_64-unknown-linux-gnu). Can you confirm that it works for you now?

hakoerber commented 1 year ago

As a tangent:

It looks like nightly-2023-04-20 is the version that introduced the breakage. This matches the date of the last stable release 1.69.0. I cannot find anything in the changelog that would explain the issue.

I'll just file this under "that's what you get for being on nightly" :sweat_smile:

hakoerber commented 2 months ago

Nightly is no longer required, so I guess this is solved.