Skip to content

Commit 6f14240

Browse files
committed
Auto merge of #28272 - Manishearth:improve_vec_docs, r=steveklabnik
r? @steveklabnik
2 parents 86156ac + 5e2d854 commit 6f14240

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libcollections/macros.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
/// Note that unlike array expressions this syntax supports all elements
3333
/// which implement `Clone` and the number of elements doesn't have to be
3434
/// a constant.
35+
///
36+
/// This will use `clone()` to duplicate an expression, so one should be careful
37+
/// using this with types having a nonstandard `Clone` implementation. For
38+
/// example, `vec![Rc::new(1); 5]` will create a vector of five references
39+
/// to the same boxed integer value, not five references pointing to independently
40+
/// boxed integers.
3541
#[cfg(not(test))]
3642
#[macro_export]
3743
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)