Skip to content

Commit 890c6de

Browse files
authored
Rollup merge of #139500 - jogru0:117437, r=tgross35
document panic behavior of Vec::resize and Vec::resize_with This adds panic documentation to ´Vec::resize´ and ´Vec::resize_with´. Fixes #117437.
2 parents 7bc1d3a + 4aab8e8 commit 890c6de

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: library/alloc/src/vec/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2803,6 +2803,10 @@ impl<T, A: Allocator> Vec<T, A> {
28032803
/// want to use the [`Default`] trait to generate values, you can
28042804
/// pass [`Default::default`] as the second argument.
28052805
///
2806+
/// # Panics
2807+
///
2808+
/// Panics if the new capacity exceeds `isize::MAX` _bytes_.
2809+
///
28062810
/// # Examples
28072811
///
28082812
/// ```
@@ -3010,6 +3014,10 @@ impl<T: Clone, A: Allocator> Vec<T, A> {
30103014
/// [`Clone`]), use [`Vec::resize_with`].
30113015
/// If you only need to resize to a smaller size, use [`Vec::truncate`].
30123016
///
3017+
/// # Panics
3018+
///
3019+
/// Panics if the new capacity exceeds `isize::MAX` _bytes_.
3020+
///
30133021
/// # Examples
30143022
///
30153023
/// ```

0 commit comments

Comments
 (0)