about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorWilliam Woodruff <william@trailofbits.com>2020-12-10 17:47:28 -0500
committerWilliam Woodruff <william@trailofbits.com>2020-12-10 17:47:28 -0500
commit9cf2516251c5379d3e8429342e8a392df81b9aaa (patch)
treec8cbb1c0e24fbaf766e25621594e7919103003f6 /library/std/src
parentd32c320d7eee56706486fef6be778495303afe9e (diff)
downloadrust-9cf2516251c5379d3e8429342e8a392df81b9aaa.tar.gz
rust-9cf2516251c5379d3e8429342e8a392df81b9aaa.zip
doc(array,vec): add notes about side effects when empty-initializing
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/primitive_docs.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs
index 55171ef2292..b22adbbe3d3 100644
--- a/library/std/src/primitive_docs.rs
+++ b/library/std/src/primitive_docs.rs
@@ -489,6 +489,9 @@ mod prim_pointer {}
 /// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
 ///   The type of `x` must be [`Copy`].
 ///
+/// Note that `[x; 0]` is a valid repeat expression. This will produce an empty array
+/// but will also initialize (or call) `x`, which may produce side effects.
+///
 /// Arrays of *any* size implement the following traits if the element type allows it:
 ///
 /// - [`Copy`]