]> git.proxmox.com Git - rustc.git/blame - tests/ui/impl-trait/in-trait/object-safety.rs
New upstream version 1.70.0+dfsg1
[rustc.git] / tests / ui / impl-trait / in-trait / object-safety.rs
CommitLineData
353b0b11
FG
1// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
2// revisions: current next
3
f2b60f7d
FG
4#![feature(return_position_impl_trait_in_trait)]
5#![allow(incomplete_features)]
6
7use std::fmt::Debug;
8
9trait Foo {
10 fn baz(&self) -> impl Debug;
11}
12
13impl Foo for u32 {
14 fn baz(&self) -> u32 {
15 32
16 }
17}
18
19fn main() {
20 let i = Box::new(42_u32) as Box<dyn Foo>;
21 //~^ ERROR the trait `Foo` cannot be made into an object
22 //~| ERROR the trait `Foo` cannot be made into an object
23 let s = i.baz();
24 //~^ ERROR the trait `Foo` cannot be made into an object
25}