1
- #![ unstable( feature = "raw_vec_internals" , reason = "implementation detail" , issue = "none" ) ]
1
+ wwwwwww #![ unstable( feature = "raw_vec_internals" , reason = "implementation detail" , issue = "none" ) ]
2
2
#![ doc( hidden) ]
3
3
4
4
use core:: alloc:: LayoutError ;
@@ -138,13 +138,15 @@ impl<T, A: Allocator> RawVec<T, A> {
138
138
/// Like `with_capacity`, but parameterized over the choice of
139
139
/// allocator for the returned `RawVec`.
140
140
#[ inline]
141
+ #[ track_caller]
141
142
pub fn with_capacity_in ( capacity : usize , alloc : A ) -> Self {
142
143
Self :: allocate_in ( capacity, AllocInit :: Uninitialized , alloc)
143
144
}
144
145
145
146
/// Like `with_capacity_zeroed`, but parameterized over the choice
146
147
/// of allocator for the returned `RawVec`.
147
148
#[ inline]
149
+ #[ track_caller]
148
150
pub fn with_capacity_zeroed_in ( capacity : usize , alloc : A ) -> Self {
149
151
Self :: allocate_in ( capacity, AllocInit :: Zeroed , alloc)
150
152
}
@@ -183,6 +185,7 @@ impl<T, A: Allocator> RawVec<T, A> {
183
185
}
184
186
}
185
187
188
+ #[ track_caller]
186
189
fn allocate_in ( capacity : usize , init : AllocInit , alloc : A ) -> Self {
187
190
if mem:: size_of :: < T > ( ) == 0 {
188
191
Self :: new_in ( alloc)
@@ -315,6 +318,7 @@ impl<T, A: Allocator> RawVec<T, A> {
315
318
/// # vector.push_all(&[1, 3, 5, 7, 9]);
316
319
/// # }
317
320
/// ```
321
+ #[ track_caller]
318
322
pub fn reserve ( & mut self , len : usize , additional : usize ) {
319
323
handle_reserve ( self . try_reserve ( len, additional) ) ;
320
324
}
@@ -345,6 +349,7 @@ impl<T, A: Allocator> RawVec<T, A> {
345
349
/// # Aborts
346
350
///
347
351
/// Aborts on OOM.
352
+ #[ track_caller]
348
353
pub fn reserve_exact ( & mut self , len : usize , additional : usize ) {
349
354
handle_reserve ( self . try_reserve_exact ( len, additional) ) ;
350
355
}
@@ -368,6 +373,7 @@ impl<T, A: Allocator> RawVec<T, A> {
368
373
/// # Aborts
369
374
///
370
375
/// Aborts on OOM.
376
+ #[ track_caller]
371
377
pub fn shrink_to_fit ( & mut self , amount : usize ) {
372
378
handle_reserve ( self . shrink ( amount) ) ;
373
379
}
@@ -503,6 +509,7 @@ unsafe impl<#[may_dangle] T, A: Allocator> Drop for RawVec<T, A> {
503
509
504
510
// Central function for reserve error handling.
505
511
#[ inline]
512
+ #[ track_caller]
506
513
fn handle_reserve ( result : Result < ( ) , TryReserveError > ) {
507
514
match result {
508
515
Err ( CapacityOverflow ) => capacity_overflow ( ) ,
@@ -532,6 +539,7 @@ fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
532
539
// One central function responsible for reporting capacity overflows. This'll
533
540
// ensure that the code generation related to these panics is minimal as there's
534
541
// only one location which panics rather than a bunch throughout the module.
542
+ #[ track_caller]
535
543
fn capacity_overflow ( ) -> ! {
536
544
panic ! ( "capacity overflow" ) ;
537
545
}
0 commit comments