summaryrefslogtreecommitdiffstats
path: root/src/test/ui/self/builtin-superkinds-self-type.rs
blob: c56542bb4684a66fb28f3daca3e611030065d7d0 (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);
}