Skip to main content

clamped_range

Function clamped_range 

Source
fn clamped_range(pd: &PositionalDiagnostic) -> Range<usize>
Expand description

Clamp the byte range to [0, source.len()] so an out-of-bounds offset (e.g. a parser pos past EOF) doesn’t panic inside annotate-snippets.