diff options
| author | bors <bors@rust-lang.org> | 2021-07-31 03:00:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-31 03:00:20 +0000 |
| commit | b289bb7fdfcb6f54d825927ab9b5722cabc2a140 (patch) | |
| tree | 9d38fa33b1fce8154a2643c769fd1f9f116952cd /library/alloc/src/vec | |
| parent | 199d1aebe472585e1066334d5e1f740f02eba661 (diff) | |
| parent | 624df182ea20fa64509b21998a8a758b7bd3dd58 (diff) | |
| download | rust-b289bb7fdfcb6f54d825927ab9b5722cabc2a140.tar.gz rust-b289bb7fdfcb6f54d825927ab9b5722cabc2a140.zip | |
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**
Diffstat (limited to 'library/alloc/src/vec')
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 06a7c335bf0..ba47da4821b 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -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); } |
