-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hjson-rust fails with Rust 1.48 #23
Comments
what's the story with your nu_hjson fork, @jonathandturner ? I can't find the source and it looks like it is also on an older version of serde (0.8.23). From the issues list here there seems to be no viable hjson package for rust currently. |
You can avoid the issue with serde-hjson = { version = "0.9", default-features = false } this will disable preservation of key order I made a version that patches the issue (it was and still is UB but it seems to work for now). you can use it with serde-hjson = { git = "https://github.com/Yarn/hjson-rust.git", rev = "ae3a336153d0c4f757beb848d2059123be00cb75" } My workaround for the older version of serde is to read the file to a in Cargo.toml serde-hjson = { git = "https://github.com/Yarn/hjson-rust.git", rev = "ae3a336153d0c4f757beb848d2059123be00cb75" }
serde_json = "1.0"
serde_json_old = { package = "serde_json", version = "0.8.6" } in your code assuming Thing implements serde 1.0 deserialize let mut f = std::fs::File::open(path).unwrap();
let a: serde_hjson::Value = serde_hjson::from_reader(f).unwrap();
let b = serde_json_old::to_string(&a).unwrap();
let thing: Thing = serde_json::from_str(&b).unwrap(); |
@Nutomic has tried swapping out #[inline]
fn visit_map<'de, V>(&mut self, visitor: V) -> Result<Value, V::Error>
where V: de::MapVisitor,
// where V: de::MapAccess<'de>,
{
let values = try!(MapVisitor::default().visit_map(visitor));
Ok(Value::Object(values))
} error:
This is because I tried upgrading the serde version from edit: [here's the code: Nutomic/hjson-rust#use-hashlink |
sometimes the solution is in the obvious place |
As reported in hjson/hjson-rust#23 the issue of the failing tests is the serde_hjson crate. The problem can be prevented (as reported by hjson/hjson-rust#23 (comment)) by disabling the default features of the crate (namingly preservation of key order). This commit disables the default features of serde_hjson to fix our tests. Signed-off-by: Matthias Beyer <[email protected]>
As reported in hjson/hjson-rust#23 the issue of the failing tests is the serde_hjson crate. The problem can be prevented (as reported by hjson/hjson-rust#23 (comment)) by disabling the default features of the crate (namingly preservation of key order). This commit disables the default features of serde_hjson to fix our tests. Signed-off-by: Matthias Beyer <[email protected]>
#24 has been merged, closing this. |
We've been using hjson in Nushell, and it's been great. Definitely an improvement to have a more-flexible json format.
With the latest Rust 1.48, though, we ran into an issue where one of the dependencies is leaving memory uninitialized.
Here's the full backtrace:
Assuming I'm reading that correctly, the issue is in
linked_hash_map
. I looked on their repo and it looks like it's no longer maintained.Any ideas if there's a fix for this? We'd definitely love to keep using this package.
The text was updated successfully, but these errors were encountered: