File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1004,6 +1004,31 @@ fn test_append_permutations() {
10041004 }
10051005}
10061006
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+
10071032#[ test]
10081033fn test_retain ( ) {
10091034 let mut buf = VecDeque :: new ( ) ;
You can’t perform that action at this time.
0 commit comments