File tree Expand file tree Collapse file tree 1 file changed +0
-21
lines changed Expand file tree Collapse file tree 1 file changed +0
-21
lines changed Original file line number Diff line number Diff line change @@ -315,27 +315,6 @@ mod test {
315315 assert_eq ! ( consumer. pop( ) , None ) ;
316316 }
317317
318- // This behaviour is blocked by the type system if using the safe constructor
319- #[ test]
320- fn pop_peeked_unchecked ( ) {
321- let q = unsafe { Queue :: new ( 0 ) } ;
322- q. push ( vec ! [ 1 i] ) ;
323- q. push ( vec ! [ 2 ] ) ;
324- let peeked = q. peek ( ) . unwrap ( ) ;
325-
326- assert_eq ! ( * peeked, vec![ 1 ] ) ;
327- assert_eq ! ( q. pop( ) , Some ( vec![ 1 ] ) ) ;
328-
329- assert_eq ! ( * peeked, vec![ 1 ] ) ;
330- q. push ( vec ! [ 7 ] ) ;
331-
332- // Note: This should actually expect 1, but this test is to highlight
333- // the unsafety allowed by the unchecked usage. A Rust user would not
334- // expect their peeked value to mutate like this without the type system
335- // complaining.
336- assert_eq ! ( * peeked, vec![ 7 ] ) ;
337- }
338-
339318 #[ test]
340319 fn peek ( ) {
341320 let ( mut consumer, mut producer) = queue ( 0 ) ;
You can’t perform that action at this time.
0 commit comments