Skip to content

Commit

Permalink
Add note about clone in docs for vec![]
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Sep 6, 2015
1 parent f84d53c commit 5e2d854
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libcollections/macros.rs
Expand Up @@ -32,6 +32,12 @@
/// Note that unlike array expressions this syntax supports all elements
/// which implement `Clone` and the number of elements doesn't have to be
/// a constant.
///
/// This will use `clone()` to duplicate an expression, so one should be careful
/// using this with types having a nonstandard `Clone` implementation. For
/// example, `vec![Rc::new(1); 5]` will create a vector of five references
/// to the same boxed integer value, not five references pointing to independently
/// boxed integers.
#[cfg(not(test))]
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit 5e2d854

Please sign in to comment.