Clarify the guarantees of Vec::as_ptr and Vec::as_mut_ptr when there's no allocation
This commit is contained in:
@@ -1107,7 +1107,8 @@ impl<T, A: Allocator> Vec<T, A> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a raw pointer to the vector's buffer.
|
/// Returns a raw pointer to the vector's buffer, or a dangling raw pointer
|
||||||
|
/// valid for zero sized reads if the vector didn't allocate.
|
||||||
///
|
///
|
||||||
/// The caller must ensure that the vector outlives the pointer this
|
/// The caller must ensure that the vector outlives the pointer this
|
||||||
/// function returns, or else it will end up pointing to garbage.
|
/// function returns, or else it will end up pointing to garbage.
|
||||||
@@ -1144,7 +1145,8 @@ impl<T, A: Allocator> Vec<T, A> {
|
|||||||
ptr
|
ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an unsafe mutable pointer to the vector's buffer.
|
/// Returns an unsafe mutable pointer to the vector's buffer, or a dangling
|
||||||
|
/// raw pointer valid for zero sized reads if the vector didn't allocate.
|
||||||
///
|
///
|
||||||
/// The caller must ensure that the vector outlives the pointer this
|
/// The caller must ensure that the vector outlives the pointer this
|
||||||
/// function returns, or else it will end up pointing to garbage.
|
/// function returns, or else it will end up pointing to garbage.
|
||||||
|
|||||||
Reference in New Issue
Block a user