about summary refs log tree commit diff
path: root/tests/ui/self/builtin-superkinds-self-type.rs
blob: d8e98c9c1423d5af2e0267be10032cd4a4bb9e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
}