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

if is not allowed in a const fn #1

Closed
AndreKR opened this issue Sep 20, 2020 · 5 comments
Closed

if is not allowed in a const fn #1

AndreKR opened this issue Sep 20, 2020 · 5 comments

Comments

@AndreKR
Copy link

AndreKR commented Sep 20, 2020

I'm compiling this crate because it's a dependency of the clipboard-win crate that I'm using.

It used to work alright, but today I'm re-compiling and I get an error message:

   Compiling error-code v2.0.1
error[E0658]: `if` is not allowed in a `const fn`
   --> c:\dev-tools\Rust\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\error-code-2.0.1\src\lib.rs:141:13
    |
141 | /             if self.code == 10035 {
142 | |                 return true;
143 | |             }
    | |_____________^
    |
    = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable

I'm on rustc 1.45.0-nightly (f8d394e51 2020-05-05).

@DoumanAsh
Copy link
Owner

ah this is stable in 1.46

Do you not upgrade your nightly often?
I normally only follow 1.46
Although I guess I can revert 4d6f3ee

@AndreKR
Copy link
Author

AndreKR commented Sep 20, 2020

Well, actually I wanted to simply upgrade my nightly, but I ran into another issue with that.

I opened this issue because I figured something like that is probably a breaking change or requires some kind of feature gate or something like that? (I'm quite new to Rust, so I don't know for sure.)

@AndreKR
Copy link
Author

AndreKR commented Sep 20, 2020

As far as I'm concerned I found a nightly now (nightly-2020-08-29) where both issues are ok.

@DoumanAsh
Copy link
Owner

yeah I'm normally lazy so I don't really worry about backward compatibility.
I can revert code and do not use if in const fn if you want so let me know

@DoumanAsh
Copy link
Owner

Reverted it for now, released as 2.0.2

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