We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7662528 commit b063bd4Copy full SHA for b063bd4
src/liballoc/tests/vec_deque.rs
@@ -1004,6 +1004,31 @@ fn test_append_permutations() {
1004
}
1005
1006
1007
+struct DropCounter<'a> {
1008
+ count: &'a mut u32,
1009
+}
1010
+
1011
+impl<'a> Drop for DropCounter<'a> {
1012
+ fn drop(&mut self) {
1013
+ *self.count += 1;
1014
+ }
1015
1016
1017
+#[test]
1018
+fn test_append_double_drop() {
1019
+ let (mut count_a, mut count_b) = (0, 0);
1020
+ {
1021
+ let mut a = VecDeque::new();
1022
+ let mut b = VecDeque::new();
1023
+ a.push_back(DropCounter { count: &mut count_a });
1024
+ b.push_back(DropCounter { count: &mut count_b });
1025
1026
+ a.append(&mut b);
1027
1028
+ assert_eq!(count_a, 1);
1029
+ assert_eq!(count_b, 1);
1030
1031
1032
#[test]
1033
fn test_retain() {
1034
let mut buf = VecDeque::new();
0 commit comments