News for hackers. Stuff that matters.
Re:Thoughts on Rust, a few thousand lines in by _hardwaregeek on Wednesday January 09, 2019 @05:14PM (#18869528)
I’m basically talking about Serde. Read the section titled “Parsing JSON as strongly typed data structures”. What’s nice is that you don’t have to include all the fields in the JSON in the struct. Serde will only give you the ones defined by the struct.

https://github.com/serde-rs/json/blob/master/README.md

Re:Thoughts on Rust, a few thousand lines in by hu3 on Wednesday January 09, 2019 @07:37PM (#18870514)
I'm not sure I'd consider that lib any safer than the average serialization library when things like this happen: https://github.com/serde-rs/json/issues/464
Re:Thoughts on Rust, a few thousand lines in by steveklabnik on Wednesday January 09, 2019 @08:25PM (#18870734)
Panics are memory safe, so that’s still more safe than many parsing bugs.
Re:Thoughts on Rust, a few thousand lines in by hu3 on Wednesday January 09, 2019 @09:00PM (#18870907)
The issue does not mention memory safety and neither did I. Honestly, knee-jerk reactions like "BUT MUH MEMORY SAFETY" doesn't inspire confidence specially when it couldn't help saving that dev from the troubles and bugs documented in the issue. To quote a few:

> it was a hassle to track down because Rust itself didn't complain and the panic message during serialization wouldn't tell me which file of the hundreds of thousands was causing it to die. For lack of a purpose-built tool, I had to manually bisect it until I narrowed it down.

> That said, definitely a footgun in the standard library to be remedied.

> My main concern here is getting rid of the footgun if at all possible. I really don't want to have to maintain a special "Never allow these types to creep into structs I'm deriving Serialize/Deserialize on, because the compiler certainly won't warn you" audit list.

If that's considered safe in Rust's standards then I rest my case.

Re:Thoughts on Rust, a few thousand lines in by oconnor663 on Wednesday January 09, 2019 @09:50PM (#18871121)
Safe in rust usually has a very specific meaning: https://doc.rust-lang.org/nomicon/what-unsafe-does.html
Re:Thoughts on Rust, a few thousand lines in by steveklabnik on Wednesday January 09, 2019 @09:06PM (#18870930)
Memory safety issues plague parsers, and often have dire consequences. rust claims to be memory safe. This bug does not invoke memory unsafety.

Yes, things can still be improved, but this is nowhere near as bad as many parsing bugs.