]> git.lizzy.rs Git - rust.git/blob - src/test/ui/dyn-star/upcast.rs
Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup
[rust.git] / src / test / ui / dyn-star / upcast.rs
1 // run-pass
2
3 #![feature(dyn_star, trait_upcasting)]
4 #![allow(incomplete_features)]
5
6 trait Foo: Bar {
7     fn hello(&self);
8 }
9
10 trait Bar {
11     fn world(&self);
12 }
13
14 struct W(usize);
15
16 impl Foo for W {
17     fn hello(&self) {
18         println!("hello!");
19     }
20 }
21
22 impl Bar for W {
23     fn world(&self) {
24         println!("world!");
25     }
26 }
27
28 fn main() {
29     let w: dyn* Foo = W(0);
30     w.hello();
31     let w: dyn* Bar = w;
32     w.world();
33 }