]> git.lizzy.rs Git - rust.git/blob - tests/ui/dyn-star/upcast.rs
Rollup merge of #106113 - krasimirgg:llvm-16-ext-tyid, r=nikic
[rust.git] / tests / ui / dyn-star / upcast.rs
1 // known-bug: #104800
2
3 #![feature(dyn_star, trait_upcasting)]
4
5 trait Foo: Bar {
6     fn hello(&self);
7 }
8
9 trait Bar {
10     fn world(&self);
11 }
12
13 struct W(usize);
14
15 impl Foo for W {
16     fn hello(&self) {
17         println!("hello!");
18     }
19 }
20
21 impl Bar for W {
22     fn world(&self) {
23         println!("world!");
24     }
25 }
26
27 fn main() {
28     let w: dyn* Foo = W(0);
29     w.hello();
30     let w: dyn* Bar = w;
31     w.world();
32 }