]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs-enums/classes-simple-method.rs
Rollup merge of #105843 - compiler-errors:sugg-const, r=lcnr
[rust.git] / src / test / ui / structs-enums / classes-simple-method.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(non_camel_case_types)]
4
5 struct cat {
6     meows : usize,
7
8     how_hungry : isize,
9 }
10
11 impl cat {
12     pub fn speak(&mut self) {}
13 }
14
15 fn cat(in_x : usize, in_y : isize) -> cat {
16     cat {
17         meows: in_x,
18         how_hungry: in_y
19     }
20 }
21
22 pub fn main() {
23   let mut nyan : cat = cat(52, 99);
24   let kitty = cat(1000, 2);
25   assert_eq!(nyan.how_hungry, 99);
26   assert_eq!(kitty.how_hungry, 2);
27   nyan.speak();
28 }