@@ -299,6 +299,7 @@ impl<K, V, S> IndexMap<K, V, S> {
299
299
///
300
300
/// ***Panics*** if the starting point is greater than the end point or if
301
301
/// the end point is greater than the length of the map.
302
+ #[ track_caller]
302
303
pub fn drain < R > ( & mut self , range : R ) -> Drain < ' _ , K , V >
303
304
where
304
305
R : RangeBounds < usize > ,
@@ -313,6 +314,7 @@ impl<K, V, S> IndexMap<K, V, S> {
313
314
/// the elements `[0, at)` with its previous capacity unchanged.
314
315
///
315
316
/// ***Panics*** if `at > len`.
317
+ #[ track_caller]
316
318
pub fn split_off ( & mut self , at : usize ) -> Self
317
319
where
318
320
S : Clone ,
@@ -493,6 +495,7 @@ where
493
495
/// assert_eq!(map.get_index_of(&'+'), Some(27));
494
496
/// assert_eq!(map.len(), 28);
495
497
/// ```
498
+ #[ track_caller]
496
499
pub fn insert_before ( & mut self , mut index : usize , key : K , value : V ) -> ( usize , Option < V > ) {
497
500
assert ! ( index <= self . len( ) , "index out of bounds" ) ;
498
501
match self . entry ( key) {
@@ -571,6 +574,7 @@ where
571
574
/// // This is an invalid index for moving an existing key!
572
575
/// map.shift_insert(map.len(), 'a', ());
573
576
/// ```
577
+ #[ track_caller]
574
578
pub fn shift_insert ( & mut self , index : usize , key : K , value : V ) -> Option < V > {
575
579
let len = self . len ( ) ;
576
580
match self . entry ( key) {
@@ -627,6 +631,7 @@ where
627
631
/// assert!(map.into_iter().eq([(0, '_'), (1, 'A'), (5, 'E'), (3, 'C'), (2, 'B'), (4, 'D')]));
628
632
/// assert_eq!(removed, &[(2, 'b'), (3, 'c')]);
629
633
/// ```
634
+ #[ track_caller]
630
635
pub fn splice < R , I > ( & mut self , range : R , replace_with : I ) -> Splice < ' _ , I :: IntoIter , K , V , S >
631
636
where
632
637
R : RangeBounds < usize > ,
@@ -1278,6 +1283,7 @@ impl<K, V, S> IndexMap<K, V, S> {
1278
1283
/// ***Panics*** if `from` or `to` are out of bounds.
1279
1284
///
1280
1285
/// Computes in **O(n)** time (average).
1286
+ #[ track_caller]
1281
1287
pub fn move_index ( & mut self , from : usize , to : usize ) {
1282
1288
self . core . move_index ( from, to)
1283
1289
}
@@ -1287,6 +1293,7 @@ impl<K, V, S> IndexMap<K, V, S> {
1287
1293
/// ***Panics*** if `a` or `b` are out of bounds.
1288
1294
///
1289
1295
/// Computes in **O(1)** time (average).
1296
+ #[ track_caller]
1290
1297
pub fn swap_indices ( & mut self , a : usize , b : usize ) {
1291
1298
self . core . swap_indices ( a, b)
1292
1299
}
0 commit comments