]> git.lizzy.rs Git - rust.git/blob - tests/ui/builtin-superkinds/builtin-superkinds-self-type.rs
Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk
[rust.git] / tests / 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 }