diff --git a/src/array_string.rs b/src/array_string.rs index 5c3414f..864daea 100644 --- a/src/array_string.rs +++ b/src/array_string.rs @@ -201,6 +201,7 @@ impl ArrayString /// /// assert_eq!(&string[..], "ab"); /// ``` + #[track_caller] pub fn push(&mut self, c: char) { self.try_push(c).unwrap(); } @@ -252,6 +253,7 @@ impl ArrayString /// /// assert_eq!(&string[..], "ad"); /// ``` + #[track_caller] pub fn push_str(&mut self, s: &str) { self.try_push_str(s).unwrap() } diff --git a/src/arrayvec.rs b/src/arrayvec.rs index a21bbb3..f5b89e8 100644 --- a/src/arrayvec.rs +++ b/src/arrayvec.rs @@ -77,6 +77,8 @@ impl ArrayVec { /// assert_eq!(&array[..], &[1, 2]); /// assert_eq!(array.capacity(), 16); /// ``` + #[inline] + #[track_caller] pub fn new() -> ArrayVec { assert_capacity_limit!(CAP); unsafe { @@ -172,6 +174,7 @@ impl ArrayVec { /// /// assert_eq!(&array[..], &[1, 2]); /// ``` + #[track_caller] pub fn push(&mut self, element: T) { ArrayVecImpl::push(self, element) } @@ -277,6 +280,7 @@ impl ArrayVec { /// assert_eq!(&array[..], &["y", "x"]); /// /// ``` + #[track_caller] pub fn insert(&mut self, index: usize, element: T) { self.try_insert(index, element).unwrap() } @@ -748,6 +752,7 @@ impl DerefMut for ArrayVec { /// assert_eq!(array.capacity(), 3); /// ``` impl From<[T; CAP]> for ArrayVec { + #[track_caller] fn from(array: [T; CAP]) -> Self { let array = ManuallyDrop::new(array); let mut vec = >::new(); @@ -1011,6 +1016,7 @@ impl Extend for ArrayVec { /// Extend the `ArrayVec` with an iterator. /// /// ***Panics*** if extending the vector exceeds its capacity. + #[track_caller] fn extend>(&mut self, iter: I) { unsafe { self.extend_from_iter::<_, true>(iter) @@ -1020,6 +1026,7 @@ impl Extend for ArrayVec { #[inline(never)] #[cold] +#[track_caller] fn extend_panic() { panic!("ArrayVec: capacity exceeded in extend/from_iter"); } @@ -1031,6 +1038,7 @@ impl ArrayVec { /// /// Unsafe because if CHECK is false, the length of the input is not checked. /// The caller must ensure the length of the input fits in the capacity. + #[track_caller] pub(crate) unsafe fn extend_from_iter(&mut self, iterable: I) where I: IntoIterator { diff --git a/src/arrayvec_impl.rs b/src/arrayvec_impl.rs index 6c09834..c5ebe7b 100644 --- a/src/arrayvec_impl.rs +++ b/src/arrayvec_impl.rs @@ -35,6 +35,7 @@ pub(crate) trait ArrayVecImpl { /// Return a raw mutable pointer to the vector's buffer. fn as_mut_ptr(&mut self) -> *mut Self::Item; + #[track_caller] fn push(&mut self, element: Self::Item) { self.try_push(element).unwrap() }