zesterer / ariadne

A fancy diagnostics & error reporting crate
https://crates.io/crates/ariadne
MIT License
1.79k stars 78 forks source link

Fix panic with byte indexes #103

Closed adampetro closed 8 months ago

adampetro commented 8 months ago

Fix a panic when the byte index is the end of the source, and the last character of the source is a newline.

With only the test addition and not the code change, the test fails with a panic:

failures:

---- write::tests::label_of_width_zero_at_end_of_line stdout ----
thread 'write::tests::label_of_width_zero_at_end_of_line' panicked at src/write.rs:84:59:
byte index 9 is out of bounds of `apple ==`
zesterer commented 8 months ago

Thanks!