E0658 building const-sha1-0.2.0

I am new to Rust and trying to start working with winrt-rs on Windows 10. While using build.rs to build a lib, I get several errors on the build of const-sha1-0.2.0. There are a couple of examples pasted below. There are eight errors that mention "while" and one the mentions "if."

Does anyone have insights as to how I might get past these errors?

Thanks

==== Examples ====
error[E0658]: while is not allowed in a const fn
--> C:\Users\mlhag.cargo\registry\src\github.com-1ecc6299db9ec823\const-sha1-0.2.0\src\lib.rs:140:5
|
140 | / while i < data.len() {

error[E0658]: if is not allowed in a const fn
--> C:\Users\mlhag.cargo\registry\src\github.com-1ecc6299db9ec823\const-sha1-0.2.0\src\lib.rs:141:9
|
141 | / if data.len() - i >= 64 {

That is a feature that’s currently available only on the beta and nightly compilers; it’ll be added to stable in 1.46.

And the library says so :wink: :

Minimum Supported Rust Version (MSRV)

This crate requires Rust 1.46.0-beta or newer due to the use of some const expression features.

Also note that this working with beta means it will be working with stable on August 27th.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.