xlc / lite-json

Simple JSON parser written with Rust. Wasm / no_std ready.
Apache License 2.0
51 stars 23 forks source link

Fix noncompiling matchers in `literals` macro #14

Closed dtolnay closed 4 years ago

dtolnay commented 4 years ago

It's possible this was hitting a compiler bug before, but for whatever reason the literals macro doesn't seem to work as written. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d0c8d46f71a62369c5e2709181e7f046 for analogous code extracted out to the playground.

This PR changes the matcher for $value from $($value:expr)+ to $($($value:literal)..=+)|+ which does work -- see https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b6fd7a18f6ed0a5c94f892ab100a5d11.

xlc commented 4 years ago

Thanks for the PR.

Interesting this code always compiles for me (and few other users) as well as in GH action.