diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-09-06 20:27:37 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-09-07 03:57:20 +0530 |
| commit | 5e2d8545e8f470a9b25f54e84d93e808e17d73e4 (patch) | |
| tree | 047a3477f8ff97b1d21b019bf646c3a908deefcc /src | |
| parent | f84d53ca0afaeac14903d16ab24455f6170795e1 (diff) | |
Add note about clone in docs for vec![]
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcollections/macros.rs | 6 |
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")] |
