mem::size_of::<T> not const - use of type variable from outer function #56794
Labels
A-const-eval
Area: Constant evaluation, covers all const contexts (static, const fn, ...)
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following CDR-serde implementation defines functions to serialize data-types such as u16, u32 etc. It is using an abstract function to align write-position, to match with multiple of mem::size_of(), where T is a primitive int or float type.
As the bytesize is known at compile time, I would like to declare the value as const, using the following patch ://github.com/frehberg/cdr-rs/pull/1
but compiler yields with error
As the generic function is not exported by lib, and it is instanciated only from inside the crate, I am wondering why the compiler is not able to derive the type of parameter T.
Any idea?
EDIT the explanation of E0401 does not fit to this code
The text was updated successfully, but these errors were encountered: