rust/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs

14 lines
227 B
Rust

// compile-flags: -Ztrait-solver=next
// check-pass
use std::any::Any;
fn needs_usize(_: &usize) {}
fn main() {
let x: &dyn Any = &1usize;
if let Some(x) = x.downcast_ref::<usize>() {
needs_usize(x);
}
}