]>
Commit | Line | Data |
---|---|---|
416331ca | 1 | // run-pass |
1a4d82fc JJ |
2 | // Tests "capabilities" granted by traits that inherit from super- |
3 | // builtin-kinds, e.g., if a trait requires Send to implement, then | |
4 | // at usage site of that trait, we know we have the Send capability. | |
5 | ||
c34b1796 | 6 | |
1a4d82fc JJ |
7 | use std::sync::mpsc::{channel, Sender, Receiver}; |
8 | ||
9 | trait Foo : Send { } | |
10 | ||
11 | impl <T: Send> Foo for T { } | |
12 | ||
85aaf69f | 13 | fn foo<T: Foo + 'static>(val: T, chan: Sender<T>) { |
1a4d82fc JJ |
14 | chan.send(val).unwrap(); |
15 | } | |
16 | ||
17 | pub fn main() { | |
c34b1796 | 18 | let (tx, rx): (Sender<isize>, Receiver<isize>) = channel(); |
85aaf69f | 19 | foo(31337, tx); |
62682a34 | 20 | assert_eq!(rx.recv().unwrap(), 31337); |
1a4d82fc | 21 | } |