mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 11:34:11 +00:00
18 lines
371 B
Rust
18 lines
371 B
Rust
// compile-flags: -Znext-solver
|
|
// check-pass
|
|
|
|
// Test that selection prefers the builtin trait object impl for `Any`
|
|
// instead of the user defined impl. Both impls apply to the trait
|
|
// object.
|
|
|
|
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);
|
|
}
|
|
}
|