Closed
Description
Prior to Rust 1.56, I could use const usize
values when defining rkyv structs. However, in Rust 1.56, this is no longer allowed.
Code
I tried this code:
const ARRAY_SIZE: usize = 32;
#[derive(rkyv::Archive, rkyv::Deserialize)]
struct SomeStruct1 {
buffer_one: Option<[u8; ARRAY_SIZE]>,
buffer_two: Option<[u8; ARRAY_SIZE]>,
}
fn main() {
println!("Pass");
}
I expected to see this happen: Prior to Rust 1.56, this compiled.
Instead, this happened: The following error appears:
error[E0284]: type annotations needed: cannot satisfy `<Option<[u8; 32]> as Archive>::Archived == _`
--> src\main.rs:3:25
|
3 | #[derive(rkyv::Archive, rkyv::Deserialize)]
| ^^^^^^^^^^^^^^^^^ cannot satisfy `<Option<[u8; 32]> as Archive>::Archived == _`
|
= note: this error originates in the derive macro `rkyv::Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0284`.
error: could not compile `rkyv-test` due to previous error
Version it worked on
It most recently worked on: Rust 1.55
Version with regression
rustc --version --verbose
:
rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-pc-windows-msvc
release: 1.56.0
LLVM version: 13.0.0