@@ -490,6 +490,8 @@ impl<T> Vec<T> {
490490 /// This is highly unsafe, due to the number of invariants that aren't
491491 /// checked:
492492 ///
493+ /// * `ptr` must have been allocated using the global allocator, such as via
494+ /// the [`alloc::alloc`] function.
493495 /// * `T` needs to have the same alignment as what `ptr` was allocated with.
494496 /// (`T` having a less strict alignment is not sufficient, the alignment really
495497 /// needs to be equal to satisfy the [`dealloc`] requirement that memory must be
@@ -526,6 +528,7 @@ impl<T> Vec<T> {
526528 /// function.
527529 ///
528530 /// [`String`]: crate::string::String
531+ /// [`alloc::alloc`]: crate::alloc::alloc
529532 /// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc
530533 ///
531534 /// # Examples
@@ -681,6 +684,7 @@ impl<T, A: Allocator> Vec<T, A> {
681684 /// This is highly unsafe, due to the number of invariants that aren't
682685 /// checked:
683686 ///
687+ /// * `ptr` must be [*currently allocated*] via the given allocator `alloc`.
684688 /// * `T` needs to have the same alignment as what `ptr` was allocated with.
685689 /// (`T` having a less strict alignment is not sufficient, the alignment really
686690 /// needs to be equal to satisfy the [`dealloc`] requirement that memory must be
@@ -714,6 +718,7 @@ impl<T, A: Allocator> Vec<T, A> {
714718 ///
715719 /// [`String`]: crate::string::String
716720 /// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc
721+ /// [*currently allocated*]: crate::alloc::Allocator#currently-allocated-memory
717722 /// [*fit*]: crate::alloc::Allocator#memory-fitting
718723 ///
719724 /// # Examples
0 commit comments