File tree 2 files changed +6
-0
lines changed
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 29
29
/// to the same boxed integer value, not five references pointing to independently
30
30
/// boxed integers.
31
31
///
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.
34
+ ///
32
35
/// [`Vec`]: crate::vec::Vec
33
36
#[ cfg( not( test) ) ]
34
37
#[ macro_export]
Original file line number Diff line number Diff line change @@ -489,6 +489,9 @@ mod prim_pointer {}
489
489
/// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
490
490
/// The type of `x` must be [`Copy`].
491
491
///
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.
494
+ ///
492
495
/// Arrays of *any* size implement the following traits if the element type allows it:
493
496
///
494
497
/// - [`Copy`]
You can’t perform that action at this time.
0 commit comments