Add custom error message for rope cursor slice precondition
This commit is contained in:
@@ -213,7 +213,12 @@ impl<'a> Cursor<'a> {
|
||||
}
|
||||
|
||||
pub fn slice(&mut self, end_offset: usize) -> Rope {
|
||||
debug_assert!(end_offset >= self.offset);
|
||||
debug_assert!(
|
||||
end_offset >= self.offset,
|
||||
"cannot slice backwards from {} to {}",
|
||||
self.offset,
|
||||
end_offset
|
||||
);
|
||||
|
||||
let mut slice = Rope::new();
|
||||
if let Some(start_chunk) = self.chunks.item() {
|
||||
|
||||
Reference in New Issue
Block a user