summaryrefslogtreecommitdiffstats
path: root/src/test/ui/dyn-star/upcast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/dyn-star/upcast.rs')
-rw-r--r--src/test/ui/dyn-star/upcast.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/ui/dyn-star/upcast.rs b/src/test/ui/dyn-star/upcast.rs
new file mode 100644
index 000000000..cee76ada7
--- /dev/null
+++ b/src/test/ui/dyn-star/upcast.rs
@@ -0,0 +1,33 @@
+// run-pass
+
+#![feature(dyn_star, trait_upcasting)]
+#![allow(incomplete_features)]
+
+trait Foo: Bar {
+ fn hello(&self);
+}
+
+trait Bar {
+ fn world(&self);
+}
+
+struct W(usize);
+
+impl Foo for W {
+ fn hello(&self) {
+ println!("hello!");
+ }
+}
+
+impl Bar for W {
+ fn world(&self) {
+ println!("world!");
+ }
+}
+
+fn main() {
+ let w: dyn* Foo = W(0);
+ w.hello();
+ let w: dyn* Bar = w;
+ w.world();
+}