We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0af8989 commit 734274dCopy full SHA for 734274d
alloc/tests/vec.rs
@@ -1929,3 +1929,16 @@ fn test_zero_sized_vec_push() {
1929
tester.clear();
1930
}
1931
1932
+
1933
+#[test]
1934
+fn test_vec_macro_repeat() {
1935
+ assert_eq!(vec![1; 3], vec![1, 1, 1]);
1936
+ assert_eq!(vec![1; 2], vec![1, 1]);
1937
+ assert_eq!(vec![1; 1], vec![1]);
1938
+ assert_eq!(vec![1; 0], vec![]);
1939
1940
+ // from_elem syntax (see RFC 832)
1941
+ let el = Box::new(1);
1942
+ let n = 3;
1943
+ assert_eq!(vec![el; n], vec![Box::new(1), Box::new(1), Box::new(1)]);
1944
+}
0 commit comments