Track caller on <usize as ToOffset>::to_offset
(#24503)
To get useful logs when reporting bugs involving offsets out of range Release Notes: - N/A
This commit is contained in:
parent
b1055878c7
commit
0294b19694
2 changed files with 2 additions and 0 deletions
|
@ -116,6 +116,7 @@ impl<T: ?Sized> ArenaBox<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn validate(&self) {
|
||||
assert!(
|
||||
self.valid.get(),
|
||||
|
|
|
@ -7320,6 +7320,7 @@ impl ToOffset for Point {
|
|||
}
|
||||
|
||||
impl ToOffset for usize {
|
||||
#[track_caller]
|
||||
fn to_offset<'a>(&self, snapshot: &MultiBufferSnapshot) -> usize {
|
||||
assert!(*self <= snapshot.len(), "offset is out of range");
|
||||
*self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue