Add `#[track_caller]` to `ArrayVec::push`
What changed, and why it matters
This commit adds a Rust compiler annotation to a helper function so that if it ever causes a program crash due to being full, the error message points at the code that called it rather than the helper itself. It does not change what the program does, only the quality of the crash diagnostic. There is no security vulnerability here.
No security action required. Treat as a normal code-quality/diagnostics improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change adds #[track_caller] to ArrayVec::push in internals/src/array_vec.rs. This attribute instructs the Rust compiler to preserve the caller’s location for panic reporting. The function’s behavior, capacity checks, and panic semantics are unchanged; only panic backtraces/messages will attribute the panic to the caller instead of the expect site. This is a diagnostic/quality-of-life improvement, not a functional or security fix.
Changed components
internals/src/array_vec.rsArrayVec::pushInspect captured patch +1 / −0
diff --git a/internals/src/array_vec.rs b/internals/src/array_vec.rs
index 8aa90d73..24a39e19 100644
--- a/internals/src/array_vec.rs
+++ b/internals/src/array_vec.rs
@@ -66,6 +66,7 @@ mod safety_boundary {
/// # Panics
///
/// If the length would increase past CAP.
+ #[track_caller]
pub fn push(&mut self, element: T) {
self.try_push(element).expect("push past the capacity of the array");
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.