]> git.proxmox.com Git - rustc.git/blame - src/libcore/benches/any.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / libcore / benches / any.rs
CommitLineData
8bb4bdeb 1use core::any::*;
60c5eb7d 2use test::{black_box, Bencher};
1a4d82fc 3
8bb4bdeb
XL
4#[bench]
5fn 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}