@@ -490,6 +490,8 @@ impl<T> Vec<T> {
490
490
/// This is highly unsafe, due to the number of invariants that aren't
491
491
/// checked:
492
492
///
493
+ /// * `ptr` must have been allocated using the global allocator, such as via
494
+ /// the [`alloc::alloc`] function.
493
495
/// * `T` needs to have the same alignment as what `ptr` was allocated with.
494
496
/// (`T` having a less strict alignment is not sufficient, the alignment really
495
497
/// needs to be equal to satisfy the [`dealloc`] requirement that memory must be
@@ -526,6 +528,7 @@ impl<T> Vec<T> {
526
528
/// function.
527
529
///
528
530
/// [`String`]: crate::string::String
531
+ /// [`alloc::alloc`]: crate::alloc::alloc
529
532
/// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc
530
533
///
531
534
/// # Examples
@@ -681,6 +684,7 @@ impl<T, A: Allocator> Vec<T, A> {
681
684
/// This is highly unsafe, due to the number of invariants that aren't
682
685
/// checked:
683
686
///
687
+ /// * `ptr` must be [*currently allocated*] via the given allocator `alloc`.
684
688
/// * `T` needs to have the same alignment as what `ptr` was allocated with.
685
689
/// (`T` having a less strict alignment is not sufficient, the alignment really
686
690
/// needs to be equal to satisfy the [`dealloc`] requirement that memory must be
@@ -714,6 +718,7 @@ impl<T, A: Allocator> Vec<T, A> {
714
718
///
715
719
/// [`String`]: crate::string::String
716
720
/// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc
721
+ /// [*currently allocated*]: crate::alloc::Allocator#currently-allocated-memory
717
722
/// [*fit*]: crate::alloc::Allocator#memory-fitting
718
723
///
719
724
/// # Examples
0 commit comments