summaryrefslogtreecommitdiffstats
path: root/src/test/ui/self/builtin-superkinds-self-type.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/self/builtin-superkinds-self-type.rs')
-rw-r--r--src/test/ui/self/builtin-superkinds-self-type.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/self/builtin-superkinds-self-type.rs b/src/test/ui/self/builtin-superkinds-self-type.rs
new file mode 100644
index 000000000..c56542bb4
--- /dev/null
+++ b/src/test/ui/self/builtin-superkinds-self-type.rs
@@ -0,0 +1,20 @@
+// run-pass
+// Tests the ability for the Self type in default methods to use
+// capabilities granted by builtin kinds as supertraits.
+
+
+use std::sync::mpsc::{Sender, channel};
+
+trait Foo : Send + Sized + 'static {
+ fn foo(self, tx: Sender<Self>) {
+ tx.send(self).unwrap();
+ }
+}
+
+impl <T: Send + 'static> Foo for T { }
+
+pub fn main() {
+ let (tx, rx) = channel();
+ 1193182.foo(tx);
+ assert_eq!(rx.recv().unwrap(), 1193182);
+}