We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 379b18b commit 12f959bCopy full SHA for 12f959b
library/alloc/tests/vec_deque.rs
@@ -1045,6 +1045,20 @@ fn test_append_double_drop() {
1045
assert_eq!(count_b, 1);
1046
}
1047
1048
+#[test]
1049
+#[should_panic]
1050
+fn test_append_zst_capacity_overflow() {
1051
+ let mut v = Vec::with_capacity(usize::MAX);
1052
+ // note: using resize instead of set_len here would
1053
+ // be *extremely* slow in unoptimized builds.
1054
+ // SAFETY: `v` has capacity `usize::MAX`, and no initialization
1055
+ // is needed for empty tuples.
1056
+ unsafe { v.set_len(usize::MAX) };
1057
+ let mut v = VecDeque::from(v);
1058
+ let mut w = vec![()].into();
1059
+ v.append(&mut w);
1060
+}
1061
+
1062
#[test]
1063
fn test_retain() {
1064
let mut buf = VecDeque::new();
0 commit comments