I get an error from one of my dependencies bytes
0.5.2
. Here a code example of the error:
pub const fn foo(foo: &'static [u8]) -> usize {
foo.len()
}
error: `core::slice::<impl [T]>::len` is not yet stable as a const fn
--> <source>:2:5
|
2 | foo.len()
| ^^^^^^^^^
error: aborting due to previous error
active toolchain
----------------
stable-x86_64-pc-windows-msvc (default) rustc 1.38.0 (625451e37 2019-09-23)
An expression declared as const or constexpr didn't evaluate to a constant at compile time. The compiler must be able to determine the value of the expression at the point it's used.
The compiler could not find the specified type library. Check to make sure that you have specified the path correctly. The imported type library is corrupt, invalid, or only partially constructed. The type library could not be generated. One possible cause of this error is specifying a path to the IDL file that is longer than 126 characters.
The compiler detected a syntax error at the specified line. cannot recover from earlier syntax errors; aborting compilation The MIDL compiler automatically tries to recover from syntax errors by adding or removing syntactic elements. This message indicates that despite these attempts to recover, the compiler detected too many errors.
The MIDL compiler automatically tries to recover from syntax errors by adding or removing syntactic elements. This message indicates that despite these attempts to recover, the compiler detected too many errors. Correct the specified error (s) and recompile. The specified C pragma is not supported in MIDL. Remove the pragma from the IDL file.
The 0.5.x
would appear to require Rust 1.39 so the easiest option would likely be upgrading to the newest version.
The error states
core::slice::<impl [T]>::len
is not yet stable as a const fn
and if you look at the release notes for 1.39
you can see that one of the entries is
str::len
,[T]::len
andstr::as_bytes
are now const functions
so this crate specifically requires >=1.39
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With