From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- library/core/benches/any.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 library/core/benches/any.rs (limited to 'library/core/benches/any.rs') diff --git a/library/core/benches/any.rs b/library/core/benches/any.rs new file mode 100644 index 000000000..53099b782 --- /dev/null +++ b/library/core/benches/any.rs @@ -0,0 +1,12 @@ +use core::any::*; +use test::{black_box, Bencher}; + +#[bench] +fn bench_downcast_ref(b: &mut Bencher) { + b.iter(|| { + let mut x = 0; + let mut y = &mut x as &mut dyn Any; + black_box(&mut y); + black_box(y.downcast_ref::() == Some(&0)); + }); +} -- cgit v1.2.3