#[test]
fn drop_full() {
let (tx, _rx) = channel::<Box<isize>>();
- tx.send(box 1).unwrap();
+ tx.send(Box::new(1)).unwrap();
}
#[test]
let (tx, _rx) = channel::<Box<isize>>();
drop(tx.clone());
drop(tx.clone());
- tx.send(box 1).unwrap();
+ tx.send(Box::new(1)).unwrap();
}
#[test]
// Testing that the sender cleans up the payload if receiver is closed
let (tx, rx) = channel::<Box<i32>>();
drop(rx);
- assert!(tx.send(box 0).is_err());
+ assert!(tx.send(Box::new(0)).is_err());
}
#[test]
#[test]
fn oneshot_single_thread_send_then_recv() {
let (tx, rx) = channel::<Box<i32>>();
- tx.send(box 10).unwrap();
+ tx.send(Box::new(10)).unwrap();
assert!(*rx.recv().unwrap() == 10);
}
assert!(*rx.recv().unwrap() == 10);
});
- tx.send(box 10).unwrap();
+ tx.send(Box::new(10)).unwrap();
}
#[test]
for _ in 0..stress_factor() {
let (tx, rx) = channel::<Box<isize>>();
let _t = thread::spawn(move || {
- tx.send(box 10).unwrap();
+ tx.send(Box::new(10)).unwrap();
});
assert!(*rx.recv().unwrap() == 10);
}
}
thread::spawn(move || {
- tx.send(box i).unwrap();
+ tx.send(Box::new(i)).unwrap();
send(tx, i + 1);
});
}