chyh1990 / yaml-rust

A pure rust YAML implementation.
Apache License 2.0
601 stars 138 forks source link

Panic uninitialised linked hash map #167

Open martinellison opened 3 years ago

martinellison commented 3 years ago

When I try to deserialise YAML using serde, I get the following traceback:

thread 'test::simple' panicked at 'attempted to leave type `linked_hash_map::Node<yaml::Yaml, yaml::Yaml>` uninitialized, which is invalid', /home/martin/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:658:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
   2: core::panicking::panic
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:50
   3: core::mem::uninitialized
             at /home/martin/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:658
   4: linked_hash_map::LinkedHashMap<K,V,S>::ensure_guard_node
             at /home/martin/.cargo/registry/src/github.com-1ecc6299db9ec823/linked-hash-map-0.5.2/src/lib.rs:174
   5: linked_hash_map::LinkedHashMap<K,V,S>::insert
             at /home/martin/.cargo/registry/src/github.com-1ecc6299db9ec823/linked-hash-map-0.5.2/src/lib.rs:304
   6: <serde_yaml::ser::SerializeMap as serde::ser::SerializeMap>::serialize_entry
             at /home/martin/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_yaml-0.8.11/src/ser.rs:342
   7: <serde::private::ser::FlatMapSerializeStruct<M> as serde::ser::SerializeStruct>::serialize_field
             at /home/martin/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.118/src/private/ser.rs:1282
doronaco commented 3 years ago

Just solved a similar problem. For me it happend with rust version 1.48.0 After moving back to 1.47.0 it was solved

fhennig commented 3 years ago

I've had this issue and version 0.4.5 fixes it, thank you very much!