summaryrefslogtreecommitdiffstats
path: root/src/test/ui/dyn-star/method.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/dyn-star/method.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/dyn-star/method.rs b/src/test/ui/dyn-star/method.rs
new file mode 100644
index 000000000..d04958ca2
--- /dev/null
+++ b/src/test/ui/dyn-star/method.rs
@@ -0,0 +1,26 @@
+// run-pass
+#![feature(dyn_star)]
+#![allow(incomplete_features)]
+
+trait Foo {
+ fn get(&self) -> usize;
+}
+
+impl Foo for usize {
+ fn get(&self) -> usize {
+ *self
+ }
+}
+
+fn invoke_dyn_star(i: dyn* Foo) -> usize {
+ i.get()
+}
+
+fn make_and_invoke_dyn_star(i: usize) -> usize {
+ let dyn_i: dyn* Foo = i as dyn* Foo;
+ invoke_dyn_star(dyn_i)
+}
+
+fn main() {
+ println!("{}", make_and_invoke_dyn_star(42));
+}