Skip to content

Commit 1915cd1

Browse files
committed
Add missing dyn in tests
1 parent b29a6fb commit 1915cd1

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/libstd/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,13 @@ mod tests {
533533
#[test]
534534
fn downcasting() {
535535
let mut a = A;
536-
let a = &mut a as &mut (Error + 'static);
536+
let a = &mut a as &mut (dyn Error + 'static);
537537
assert_eq!(a.downcast_ref::<A>(), Some(&A));
538538
assert_eq!(a.downcast_ref::<B>(), None);
539539
assert_eq!(a.downcast_mut::<A>(), Some(&mut A));
540540
assert_eq!(a.downcast_mut::<B>(), None);
541541

542-
let a: Box<Error> = Box::new(A);
542+
let a: Box<dyn Error> = Box::new(A);
543543
match a.downcast::<B>() {
544544
Ok(..) => panic!("expected error"),
545545
Err(e) => assert_eq!(*e.downcast::<A>().unwrap(), A),

src/libstd/io/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ mod tests {
223223
assert_eq!(copy(&mut r, &mut w).unwrap(), 4);
224224

225225
let mut r = repeat(0).take(1 << 17);
226-
assert_eq!(copy(&mut r as &mut Read, &mut w as &mut Write).unwrap(), 1 << 17);
226+
assert_eq!(copy(&mut r as &mut dyn Read, &mut w as &mut dyn Write).unwrap(), 1 << 17);
227227
}
228228

229229
#[test]

src/libstd/net/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ mod tests {
927927
use time::{Instant, Duration};
928928
use thread;
929929

930-
fn each_ip(f: &mut FnMut(SocketAddr)) {
930+
fn each_ip(f: &mut dyn FnMut(SocketAddr)) {
931931
f(next_test_ip4());
932932
f(next_test_ip6());
933933
}

src/libstd/net/udp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ mod tests {
826826
use time::{Instant, Duration};
827827
use thread;
828828

829-
fn each_ip(f: &mut FnMut(SocketAddr, SocketAddr)) {
829+
fn each_ip(f: &mut dyn FnMut(SocketAddr, SocketAddr)) {
830830
f(next_test_ip4(), next_test_ip4());
831831
f(next_test_ip6(), next_test_ip6());
832832
}

src/libstd/thread/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ mod tests {
14381438
rx.recv().unwrap();
14391439
}
14401440

1441-
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Box<Fn() + Send>) {
1441+
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Box<dyn Fn() + Send>) {
14421442
let (tx, rx) = channel();
14431443

14441444
let x: Box<_> = box 1;
@@ -1485,7 +1485,7 @@ mod tests {
14851485
// (well, it would if the constant were 8000+ - I lowered it to be more
14861486
// valgrind-friendly. try this at home, instead..!)
14871487
const GENERATIONS: u32 = 16;
1488-
fn child_no(x: u32) -> Box<Fn() + Send> {
1488+
fn child_no(x: u32) -> Box<dyn Fn() + Send> {
14891489
return Box::new(move|| {
14901490
if x < GENERATIONS {
14911491
thread::spawn(move|| child_no(x+1)());
@@ -1531,10 +1531,10 @@ mod tests {
15311531
#[test]
15321532
fn test_try_panic_message_any() {
15331533
match thread::spawn(move|| {
1534-
panic!(box 413u16 as Box<Any + Send>);
1534+
panic!(box 413u16 as Box<dyn Any + Send>);
15351535
}).join() {
15361536
Err(e) => {
1537-
type T = Box<Any + Send>;
1537+
type T = Box<dyn Any + Send>;
15381538
assert!(e.is::<T>());
15391539
let any = e.downcast::<T>().unwrap();
15401540
assert!(any.is::<u16>());

0 commit comments

Comments
 (0)