diff --git a/library/std/src/io/error/tests.rs b/library/std/src/io/error/tests.rs index 6fd15fa8048..8d7877bcad3 100644 --- a/library/std/src/io/error/tests.rs +++ b/library/std/src/io/error/tests.rs @@ -17,10 +17,10 @@ fn test_debug_error() { let msg = error_string(code); let kind = decode_error_kind(code); let err = Error { - repr: Repr::new_custom(box Custom { + repr: Repr::new_custom(Box::new(Custom { kind: ErrorKind::InvalidInput, - error: box Error { repr: super::Repr::new_os(code) }, - }), + error: Box::new(Error { repr: super::Repr::new_os(code) }), + })), }; let expected = format!( "Custom {{ \ diff --git a/library/std/src/sync/mpsc/mpsc_queue/tests.rs b/library/std/src/sync/mpsc/mpsc_queue/tests.rs index 348b83424b0..9f4f31ed051 100644 --- a/library/std/src/sync/mpsc/mpsc_queue/tests.rs +++ b/library/std/src/sync/mpsc/mpsc_queue/tests.rs @@ -6,8 +6,8 @@ use crate::thread; #[test] fn test_full() { let q: Queue> = Queue::new(); - q.push(box 1); - q.push(box 2); + q.push(Box::new(1)); + q.push(Box::new(2)); } #[test] diff --git a/library/std/src/sync/mpsc/spsc_queue/tests.rs b/library/std/src/sync/mpsc/spsc_queue/tests.rs index e4fd15cbbde..467ef3dbdcb 100644 --- a/library/std/src/sync/mpsc/spsc_queue/tests.rs +++ b/library/std/src/sync/mpsc/spsc_queue/tests.rs @@ -47,8 +47,8 @@ fn peek() { fn drop_full() { unsafe { let q: Queue> = Queue::with_additions(0, (), ()); - q.push(box 1); - q.push(box 2); + q.push(Box::new(1)); + q.push(Box::new(2)); } } diff --git a/library/std/src/sync/mpsc/sync_tests.rs b/library/std/src/sync/mpsc/sync_tests.rs index 0052a38f7bb..e58649bab6e 100644 --- a/library/std/src/sync/mpsc/sync_tests.rs +++ b/library/std/src/sync/mpsc/sync_tests.rs @@ -20,7 +20,7 @@ fn smoke() { #[test] fn drop_full() { let (tx, _rx) = sync_channel::>(1); - tx.send(box 1).unwrap(); + tx.send(Box::new(1)).unwrap(); } #[test] @@ -238,7 +238,7 @@ fn oneshot_single_thread_send_port_close() { // Testing that the sender cleans up the payload if receiver is closed let (tx, rx) = sync_channel::>(0); drop(rx); - assert!(tx.send(box 0).is_err()); + assert!(tx.send(Box::new(0)).is_err()); } #[test] @@ -257,7 +257,7 @@ fn oneshot_single_thread_recv_chan_close() { #[test] fn oneshot_single_thread_send_then_recv() { let (tx, rx) = sync_channel::>(1); - tx.send(box 10).unwrap(); + tx.send(Box::new(10)).unwrap(); assert!(*rx.recv().unwrap() == 10); } @@ -333,7 +333,7 @@ fn oneshot_multi_task_recv_then_send() { assert!(*rx.recv().unwrap() == 10); }); - tx.send(box 10).unwrap(); + tx.send(Box::new(10)).unwrap(); } #[test] @@ -398,7 +398,7 @@ fn oneshot_multi_thread_send_recv_stress() { for _ in 0..stress_factor() { let (tx, rx) = sync_channel::>(0); let _t = thread::spawn(move || { - tx.send(box 10).unwrap(); + tx.send(Box::new(10)).unwrap(); }); assert!(*rx.recv().unwrap() == 10); } @@ -418,7 +418,7 @@ fn stream_send_recv_stress() { } thread::spawn(move || { - tx.send(box i).unwrap(); + tx.send(Box::new(i)).unwrap(); send(tx, i + 1); }); } diff --git a/library/std/src/sync/mpsc/tests.rs b/library/std/src/sync/mpsc/tests.rs index 184ce193cbe..4deb3e59615 100644 --- a/library/std/src/sync/mpsc/tests.rs +++ b/library/std/src/sync/mpsc/tests.rs @@ -20,7 +20,7 @@ fn smoke() { #[test] fn drop_full() { let (tx, _rx) = channel::>(); - tx.send(box 1).unwrap(); + tx.send(Box::new(1)).unwrap(); } #[test] @@ -28,7 +28,7 @@ fn drop_full_shared() { let (tx, _rx) = channel::>(); drop(tx.clone()); drop(tx.clone()); - tx.send(box 1).unwrap(); + tx.send(Box::new(1)).unwrap(); } #[test] @@ -229,7 +229,7 @@ fn oneshot_single_thread_send_port_close() { // Testing that the sender cleans up the payload if receiver is closed let (tx, rx) = channel::>(); drop(rx); - assert!(tx.send(box 0).is_err()); + assert!(tx.send(Box::new(0)).is_err()); } #[test] @@ -248,7 +248,7 @@ fn oneshot_single_thread_recv_chan_close() { #[test] fn oneshot_single_thread_send_then_recv() { let (tx, rx) = channel::>(); - tx.send(box 10).unwrap(); + tx.send(Box::new(10)).unwrap(); assert!(*rx.recv().unwrap() == 10); } @@ -309,7 +309,7 @@ fn oneshot_multi_task_recv_then_send() { assert!(*rx.recv().unwrap() == 10); }); - tx.send(box 10).unwrap(); + tx.send(Box::new(10)).unwrap(); } #[test] @@ -374,7 +374,7 @@ fn oneshot_multi_thread_send_recv_stress() { for _ in 0..stress_factor() { let (tx, rx) = channel::>(); let _t = thread::spawn(move || { - tx.send(box 10).unwrap(); + tx.send(Box::new(10)).unwrap(); }); assert!(*rx.recv().unwrap() == 10); } @@ -394,7 +394,7 @@ fn stream_send_recv_stress() { } thread::spawn(move || { - tx.send(box i).unwrap(); + tx.send(Box::new(i)).unwrap(); send(tx, i + 1); }); } diff --git a/library/std/src/thread/tests.rs b/library/std/src/thread/tests.rs index 7386fe1c442..5b8309cf5d2 100644 --- a/library/std/src/thread/tests.rs +++ b/library/std/src/thread/tests.rs @@ -127,7 +127,7 @@ where { let (tx, rx) = channel(); - let x: Box<_> = box 1; + let x: Box<_> = Box::new(1); let x_in_parent = (&*x) as *const i32 as usize; spawnfn(Box::new(move || { @@ -219,7 +219,7 @@ fn test_try_panic_any_message_owned_str() { #[test] fn test_try_panic_any_message_any() { match thread::spawn(move || { - panic_any(box 413u16 as Box); + panic_any(Box::new(413u16) as Box); }) .join() {