We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 586b51a commit c47274bCopy full SHA for c47274b
library/alloc/tests/vec.rs
@@ -1094,6 +1094,18 @@ fn test_from_iter_specialization_panic_during_drop_leaks() {
1094
}
1095
1096
1097
+// regression test for issue #85322. Peekable previously implemented InPlaceIterable,
1098
+// but due to an interaction with IntoIter's current Clone implementation it failed to uphold
1099
+// the contract.
1100
+#[test]
1101
+fn test_collect_after_iterator_clone() {
1102
+ let v = vec![0; 5];
1103
+ let mut i = v.into_iter().peekable();
1104
+ i.peek();
1105
+ let v = i.clone().collect::<Vec<_>>();
1106
+ assert!(v.len() <= v.capacity());
1107
+}
1108
+
1109
#[test]
1110
fn test_cow_from() {
1111
let borrowed: &[_] = &["borrowed", "(slice)"];
0 commit comments