]> git.lizzy.rs Git - rust.git/blob - src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / builtin-superkinds / builtin-superkinds-self-type.rs
1 // Tests (negatively) the ability for the Self type in default methods
2 // to use capabilities granted by builtin kinds as supertraits.
3
4 use std::sync::mpsc::{channel, Sender};
5
6 trait Foo : Sized+Sync+'static {
7     fn foo(self, mut chan: Sender<Self>) { }
8 }
9
10 impl <T: Sync> Foo for T { }
11 //~^ ERROR the parameter type `T` may not live long enough
12
13 fn main() {
14     let (tx, rx) = channel();
15     1193182.foo(tx);
16     assert_eq!(rx.recv(), 1193182);
17 }