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

build doesn't work with latest nightly? #57

Closed
colemickens opened this issue Apr 29, 2023 · 4 comments
Closed

build doesn't work with latest nightly? #57

colemickens opened this issue Apr 29, 2023 · 4 comments

Comments

@colemickens
Copy link

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
Copy link
Owner

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
Copy link
Owner

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 hakoerber reopened this May 4, 2023
@hakoerber
Copy link
Owner

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" 😅

@hakoerber
Copy link
Owner

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

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