]> git.lizzy.rs Git - rust.git/blob - src/test/ui/builtin-superkinds/builtin-superkinds-capabilities.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / builtin-superkinds / builtin-superkinds-capabilities.rs
1 // run-pass
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
6
7 use std::sync::mpsc::{channel, Sender, Receiver};
8
9 trait Foo : Send { }
10
11 impl <T: Send> Foo for T { }
12
13 fn foo<T: Foo + 'static>(val: T, chan: Sender<T>) {
14     chan.send(val).unwrap();
15 }
16
17 pub fn main() {
18     let (tx, rx): (Sender<isize>, Receiver<isize>) = channel();
19     foo(31337, tx);
20     assert_eq!(rx.recv().unwrap(), 31337);
21 }