]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/in-trait/object-safety.rs
Rollup merge of #105405 - sunfishcode:sunfishcode/export-dynamic, r=TaKO8Ki
[rust.git] / src / test / ui / impl-trait / in-trait / object-safety.rs
1 #![feature(return_position_impl_trait_in_trait)]
2 #![allow(incomplete_features)]
3
4 use std::fmt::Debug;
5
6 trait Foo {
7     fn baz(&self) -> impl Debug;
8 }
9
10 impl Foo for u32 {
11     fn baz(&self) -> u32 {
12         32
13     }
14 }
15
16 fn main() {
17     let i = Box::new(42_u32) as Box<dyn Foo>;
18     //~^ ERROR the trait `Foo` cannot be made into an object
19     //~| ERROR the trait `Foo` cannot be made into an object
20     let s = i.baz();
21     //~^ ERROR the trait `Foo` cannot be made into an object
22 }