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**
This commit is contained in:
commit
b289bb7fdf
1 changed files with 2 additions and 0 deletions
|
@ -1372,9 +1372,11 @@ impl<T, A: Allocator> Vec<T, A> {
|
|||
/// assert_eq!(v, [1, 3]);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[track_caller]
|
||||
pub fn remove(&mut self, index: usize) -> T {
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
#[track_caller]
|
||||
fn assert_failed(index: usize, len: usize) -> ! {
|
||||
panic!("removal index (is {}) should be < len (is {})", index, len);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue