Auto merge of #17347 - Veykril:inv-offset-err, r=Veykril

minor: Add debug info to invalid offset error

cc https://github.com/rust-lang/rust-analyzer/issues/17289
This commit is contained in:
bors 2024-06-05 08:21:47 +00:00
commit 02c178b780

View file

@ -37,8 +37,9 @@ pub(crate) fn offset(
.ok_or_else(|| format_err!("Invalid wide col offset"))?
}
};
let text_size =
line_index.index.offset(line_col).ok_or_else(|| format_err!("Invalid offset"))?;
let text_size = line_index.index.offset(line_col).ok_or_else(|| {
format_err!("Invalid offset {line_col:?} (line index length: {:?})", line_index.index.len())
})?;
Ok(text_size)
}