Rollup merge of #44536 - Havvy:transmute-docs, r=steveklabnik

Fix example in transmute; add safety requirement to Vec::from_raw_parts

This fixes the second bullet point on #44281 and also removes some incorrect information.
This commit is contained in:
Corey Farwell
2017-09-14 22:32:47 -04:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -370,6 +370,7 @@ impl<T> Vec<T> {
///
/// * `ptr` needs to have been previously allocated via [`String`]/`Vec<T>`
/// (at least, it's highly likely to be incorrect if it wasn't).
/// * `ptr`'s `T` needs to have the same size and alignment as it was allocated with.
/// * `length` needs to be less than or equal to `capacity`.
/// * `capacity` needs to be the capacity that the pointer was allocated with.
///