rust-embedded-community / serde-json-core

`serde-json` for `no_std` programs
Apache License 2.0
161 stars 59 forks source link

Library should publicly export heapless #52

Closed ryan-summers closed 3 years ago

ryan-summers commented 3 years ago

Currently, if the user application and serde-json-core are using different versions of heapless, the compiler may throw strange errors:

(Example here, app uses heapless 0.6.0, serde-json-core 0.2.0)

error[E0308]: mismatched types
  --> src\net\router.rs:54:24
   |
54 |         self.message = serde_json_core::to_vec(&response).unwrap();
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `heapless::Vec`, found struct `heapless::vec::Vec`
   |
   = note: expected struct `heapless::Vec<u8, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>`
              found struct `heapless::vec::Vec<u8, _>`
   = note: perhaps two different versions of crate `heapless` are being used?

We should likely be publicly using the heapless types here to allow external users to sync up exactly with the version of heapless the library is using.

ryan-summers commented 3 years ago

Also, the heapless version we are depending on here is not recommended for further use due to a security vulnerability found. We should likely update the heapless version as well.