]> git.lizzy.rs Git - rust.git/blob - tests/ui/max-min-classes.rs
Rollup merge of #103418 - Aaron1011:macro-semicolon-future-incompat, r=davidtwco
[rust.git] / tests / ui / max-min-classes.rs
1 // run-pass
2
3 #![allow(non_snake_case)]
4 trait Product {
5     fn product(&self) -> isize;
6 }
7
8 struct Foo {
9     x: isize,
10     y: isize,
11 }
12
13 impl Foo {
14     pub fn sum(&self) -> isize {
15         self.x + self.y
16     }
17 }
18
19 impl Product for Foo {
20     fn product(&self) -> isize {
21         self.x * self.y
22     }
23 }
24
25 fn Foo(x: isize, y: isize) -> Foo {
26     Foo { x: x, y: y }
27 }
28
29 pub fn main() {
30     let foo = Foo(3, 20);
31     println!("{} {}", foo.sum(), foo.product());
32 }