]>
Commit | Line | Data |
---|---|---|
8bb4bdeb | 1 | use core::any::*; |
60c5eb7d | 2 | use test::{black_box, Bencher}; |
1a4d82fc | 3 | |
8bb4bdeb XL |
4 | #[bench] |
5 | fn bench_downcast_ref(b: &mut Bencher) { | |
6 | b.iter(|| { | |
7 | let mut x = 0; | |
b7449926 | 8 | let mut y = &mut x as &mut dyn Any; |
8bb4bdeb XL |
9 | black_box(&mut y); |
10 | black_box(y.downcast_ref::<isize>() == Some(&0)); | |
11 | }); | |
223e47cc | 12 | } |