Skip to content

Commit d986924

Browse files
committed
doc: apply suggestions
1 parent 9cf2516 commit d986924

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: library/alloc/src/macros.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
/// to the same boxed integer value, not five references pointing to independently
3030
/// boxed integers.
3131
///
32-
/// Also, note that `[T; 0]` is a valid initializer. This will initialize (or call)
33-
/// `T` but not populate the vector with it, so be mindful of side effects.
32+
/// Also, note that `vec![expr; 0]` is allowed, and produces an empty vector.
33+
/// This will still evaluate `expr`, however, and immediately drop the resulting value, so
34+
/// be mindful of side effects.
3435
///
3536
/// [`Vec`]: crate::vec::Vec
3637
#[cfg(not(test))]

Diff for: library/std/src/primitive_docs.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,9 @@ mod prim_pointer {}
489489
/// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
490490
/// The type of `x` must be [`Copy`].
491491
///
492-
/// Note that `[x; 0]` is a valid repeat expression. This will produce an empty array
493-
/// but will also initialize (or call) `x`, which may produce side effects.
492+
/// Note that `[expr; 0]` is allowed, and produces an empty array.
493+
/// This will still evaluate `expr`, however, and immediately drop the resulting value, so
494+
/// be mindful of side effects.
494495
///
495496
/// Arrays of *any* size implement the following traits if the element type allows it:
496497
///

0 commit comments

Comments
 (0)