Skip to content

Commit b289bb7

Browse files
committed
Auto merge of #87488 - kornelski:track-remove, r=dtolnay
Track caller of Vec::remove() `vec.remove(invalid)` doesn't print a helpful source position: > thread 'main' panicked at 'removal index (is 99) should be < len (is 1)', **library/alloc/src/vec/mod.rs:1379:13**
2 parents 199d1ae + 624df18 commit b289bb7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/alloc/src/vec/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,11 @@ impl<T, A: Allocator> Vec<T, A> {
13721372
/// assert_eq!(v, [1, 3]);
13731373
/// ```
13741374
#[stable(feature = "rust1", since = "1.0.0")]
1375+
#[track_caller]
13751376
pub fn remove(&mut self, index: usize) -> T {
13761377
#[cold]
13771378
#[inline(never)]
1379+
#[track_caller]
13781380
fn assert_failed(index: usize, len: usize) -> ! {
13791381
panic!("removal index (is {}) should be < len (is {})", index, len);
13801382
}

0 commit comments

Comments
 (0)