]>
git.proxmox.com Git - rustc.git/blob - tests/ui/traits/trait-upcasting/basic.rs
3 #![feature(trait_upcasting)]
5 trait Foo
: PartialEq
<i32> + std
::fmt
::Debug
+ Send
+ Sync
{
54 let baz
: &dyn Baz
= &1;
55 let _
: &dyn std
::fmt
::Debug
= baz
;
57 assert_eq
!(baz
.a(), 100);
58 assert_eq
!(baz
.b(), 200);
59 assert_eq
!(baz
.c(), 300);
60 assert_eq
!(baz
.z(), 11);
61 assert_eq
!(baz
.y(), 12);
62 assert_eq
!(baz
.w(), 21);
64 let bar
: &dyn Bar
= baz
;
65 let _
: &dyn std
::fmt
::Debug
= bar
;
67 assert_eq
!(bar
.a(), 100);
68 assert_eq
!(bar
.b(), 200);
69 assert_eq
!(bar
.z(), 11);
70 assert_eq
!(bar
.y(), 12);
71 assert_eq
!(bar
.w(), 21);
73 let foo
: &dyn Foo
= baz
;
74 let _
: &dyn std
::fmt
::Debug
= foo
;
76 assert_eq
!(foo
.a(), 100);
77 assert_eq
!(foo
.z(), 11);
78 assert_eq
!(foo
.y(), 12);
80 let foo
: &dyn Foo
= bar
;
81 let _
: &dyn std
::fmt
::Debug
= foo
;
83 assert_eq
!(foo
.a(), 100);
84 assert_eq
!(foo
.z(), 11);
85 assert_eq
!(foo
.y(), 12);