about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-09-06 20:27:37 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-09-07 03:57:20 +0530
commit5e2d8545e8f470a9b25f54e84d93e808e17d73e4 (patch)
tree047a3477f8ff97b1d21b019bf646c3a908deefcc /src
parentf84d53ca0afaeac14903d16ab24455f6170795e1 (diff)
Add note about clone in docs for vec![]
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/macros.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcollections/macros.rs b/src/libcollections/macros.rs
index 5f614f3649c..6a683e65c9e 100644
--- a/src/libcollections/macros.rs
+++ b/src/libcollections/macros.rs
@@ -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")]