summaryrefslogtreecommitdiffstats
path: root/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs
blob: 6fba87b31975a14fab4e7f1826aefd35bc8c6bb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Tests (negatively) the ability for the Self type in default methods
// to use capabilities granted by builtin kinds as supertraits.

use std::sync::mpsc::{channel, Sender};

trait Foo : Sized+Sync+'static {
    fn foo(self, mut chan: Sender<Self>) { }
}

impl <T: Sync> Foo for T { }
//~^ ERROR the parameter type `T` may not live long enough

fn main() {
    let (tx, rx) = channel();
    1193182.foo(tx);
    assert_eq!(rx.recv(), 1193182);
}