File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 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.
34+ ///
3235/// [`Vec`]: crate::vec::Vec
3336#[ cfg( not( test) ) ]
3437#[ macro_export]
Original file line number Diff line number Diff line change @@ -489,6 +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.
494+ ///
492495/// Arrays of *any* size implement the following traits if the element type allows it:
493496///
494497/// - [`Copy`]
You can’t perform that action at this time.
0 commit comments