Advice for re2rust
8573 opened this issue · comments
re2rust is a version of the lexer generator re2c that generates Rust code rather than C.
Currently, the generated Rust code resulting from some examples in the re2rust manual, including the example at the start of the manual, is unsound in its use of get_unchecked
to avoid bounds-checks on slice indexing.
Would you have any advice on how the soundness of the re2rust examples could be improved while maintaining performance?
I have written a detailed article on avoiding bounds checks without resorting to unsafe
: https://shnatsel.medium.com/how-to-avoid-bounds-checks-in-rust-without-unsafe-f65e618b4c1e
I see the issue on the re2rust
repo contains an active discussion already, with encoding the constraint in the type system being proposed as an option. I think it's best to continue the discussion there, and not split it across two different threads.