matklad / tom

tom: a format-preserving TOML parser in Rust
Apache License 2.0
38 stars 2 forks source link

Detect index confusion #17

Open matklad opened 6 years ago

matklad commented 6 years ago

tom heavily uses indices to refer to tree nodes. This has an obvious problem that you can accidentally use index from file A with file B, and get a mysterious error down the line. We can use a trick to help to catch such errors earlier however! The idea is, when cfg(debug_assertions) is active, to add some runtime-checks. Specifically: