Skip to content

Commit 084ea21

Browse files
committed
Track caller of slice split and swap
1 parent 195e931 commit 084ea21

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: library/core/src/slice/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ impl<T> [T] {
583583
#[stable(feature = "rust1", since = "1.0.0")]
584584
#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
585585
#[inline]
586+
#[track_caller]
586587
pub const fn swap(&mut self, a: usize, b: usize) {
587588
let _ = &self[a];
588589
let _ = &self[b];
@@ -1499,6 +1500,7 @@ impl<T> [T] {
14991500
/// ```
15001501
#[stable(feature = "rust1", since = "1.0.0")]
15011502
#[inline]
1503+
#[track_caller]
15021504
pub fn split_at(&self, mid: usize) -> (&[T], &[T]) {
15031505
assert!(mid <= self.len());
15041506
// SAFETY: `[ptr; mid]` and `[mid; len]` are inside `self`, which
@@ -1529,6 +1531,7 @@ impl<T> [T] {
15291531
/// ```
15301532
#[stable(feature = "rust1", since = "1.0.0")]
15311533
#[inline]
1534+
#[track_caller]
15321535
pub fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) {
15331536
assert!(mid <= self.len());
15341537
// SAFETY: `[ptr; mid]` and `[mid; len]` are inside `self`, which
@@ -1668,6 +1671,7 @@ impl<T> [T] {
16681671
/// ```
16691672
#[unstable(feature = "split_array", reason = "new API", issue = "90091")]
16701673
#[inline]
1674+
#[track_caller]
16711675
pub fn split_array_ref<const N: usize>(&self) -> (&[T; N], &[T]) {
16721676
let (a, b) = self.split_at(N);
16731677
// SAFETY: a points to [T; N]? Yes it's [T] of length N (checked by split_at)
@@ -1699,6 +1703,7 @@ impl<T> [T] {
16991703
/// ```
17001704
#[unstable(feature = "split_array", reason = "new API", issue = "90091")]
17011705
#[inline]
1706+
#[track_caller]
17021707
pub fn split_array_mut<const N: usize>(&mut self) -> (&mut [T; N], &mut [T]) {
17031708
let (a, b) = self.split_at_mut(N);
17041709
// SAFETY: a points to [T; N]? Yes it's [T] of length N (checked by split_at_mut)

0 commit comments

Comments
 (0)