Skip to content

Deserialization in serde panics in rustc 1.48+ with some enum inner types  #812

Closed
@nicodemus26

Description

@nicodemus26

This error presents as: attempted to leave type `nalgebra::ArrayStorage<...>` uninitialized, which is invalid

This line of code panics:

let mut out: Self::Value = unsafe { mem::uninitialized() };

This panic is mentioned in the 1.48 detailed notes as

mem::uninitialized will now panic if any inner types inside a struct or enum disallow zero-initialization.

The tracking issue for this is here: rust-lang/rust#66151

The way visit_seq is implemented looks like it should correctly initialize the whole matrix or drop the partially initialized matrix and return an Err. Can this function use a compiler version switch to use MaybeUninit::uninit().assume_init() mentioned in the std::mem::uninitialized deprecation notes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions