mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
21 lines
468 B
Rust
21 lines
468 B
Rust
use std::fmt::Debug;
|
|
|
|
trait Foo {
|
|
fn baz(&self) -> impl Debug;
|
|
}
|
|
|
|
impl Foo for u32 {
|
|
fn baz(&self) -> impl Debug {
|
|
32
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let i = Box::new(42_u32) as Box<dyn Foo>;
|
|
//~^ ERROR the trait `Foo` cannot be made into an object
|
|
//~| ERROR the trait `Foo` cannot be made into an object
|
|
let s = i.baz();
|
|
//~^ ERROR the trait `Foo` cannot be made into an object
|
|
//~| ERROR the trait `Foo` cannot be made into an object
|
|
}
|