mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
13 lines
200 B
Rust
13 lines
200 B
Rust
use std::any::Any;
|
|
|
|
struct Foo;
|
|
|
|
trait Bar {}
|
|
|
|
impl Bar for Foo {}
|
|
|
|
fn main() {
|
|
let any: &dyn Any = &Bar; //~ ERROR expected value, found trait `Bar`
|
|
if any.is::<u32>() { println!("u32"); }
|
|
}
|