Skip to content

Commit 1fd8ba9

Browse files
authored
Rollup merge of #41535 - steveklabnik:gh37746, r=alexcrichton
Fix up vec guarnatee around capacity Fixes #37746 r? @rust-lang/libs
2 parents e2a0467 + 19b7272 commit 1fd8ba9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libcollections/vec.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ use Bound::{Excluded, Included, Unbounded};
275275
/// removed data to be erased for security purposes. Even if you drop a `Vec`, its
276276
/// buffer may simply be reused by another `Vec`. Even if you zero a `Vec`'s memory
277277
/// first, that may not actually happen because the optimizer does not consider
278-
/// this a side-effect that must be preserved.
278+
/// this a side-effect that must be preserved. There is one case which we will
279+
/// not break, however: using `unsafe` code to write to the excess capacity,
280+
/// and then increasing the length to match, is always valid.
279281
///
280282
/// `Vec` does not currently guarantee the order in which elements are dropped
281283
/// (the order has changed in the past, and may change again).

0 commit comments

Comments
 (0)