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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
227 B
Rust
Raw Normal View History

// 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);
}
}