]> git.proxmox.com Git - rustc.git/blame - src/test/ui/builtin-superkinds/builtin-superkinds-capabilities.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / builtin-superkinds / builtin-superkinds-capabilities.rs
CommitLineData
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
7use std::sync::mpsc::{channel, Sender, Receiver};
8
9trait Foo : Send { }
10
11impl <T: Send> Foo for T { }
12
85aaf69f 13fn foo<T: Foo + 'static>(val: T, chan: Sender<T>) {
1a4d82fc
JJ
14 chan.send(val).unwrap();
15}
16
17pub 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}