]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/issue-18655.rs
feat(rustdoc): open sidebar menu when links inside it are focused
[rust.git] / src / test / ui / associated-types / issue-18655.rs
1 // run-pass
2 trait Factory {
3     type Product;
4     fn create(&self) -> <Self as Factory>::Product;
5 }
6
7 impl Factory for f64 {
8     type Product = f64;
9     fn create(&self) -> f64 { *self * *self }
10 }
11
12 impl<A: Factory, B: Factory> Factory for (A, B) {
13     type Product = (<A as Factory>::Product, <B as Factory>::Product);
14     fn create(&self) -> (<A as Factory>::Product, <B as Factory>::Product) {
15         let (ref a, ref b) = *self;
16         (a.create(), b.create())
17     }
18 }
19
20 fn main() {
21     assert_eq!((16., 25.), (4., 5.).create());
22 }