Skip to content

Commit 5c82f48

Browse files
committed
Remove invalid test -- this test reads freed memory, from what I can tell
1 parent 18d6eef commit 5c82f48

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

src/libsync/spsc_queue.rs

-21
Original file line numberDiff line numberDiff 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![1i]);
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);

0 commit comments

Comments
 (0)