]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/bound/generic_trait.rs
Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebank
[rust.git] / src / test / ui / traits / bound / generic_trait.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(non_camel_case_types)]
4 #![allow(non_snake_case)]
5
6 trait connection {
7     fn read(&self) -> isize;
8 }
9
10 trait connection_factory<C:connection> {
11     fn create(&self) -> C;
12 }
13
14 type my_connection = ();
15 type my_connection_factory = ();
16
17 impl connection for () {
18     fn read(&self) -> isize { 43 }
19 }
20
21 impl connection_factory<my_connection> for my_connection_factory {
22     fn create(&self) -> my_connection { () }
23 }
24
25 pub fn main() {
26     let factory = ();
27     let connection = factory.create();
28     let result = connection.read();
29     assert_eq!(result, 43);
30 }