]> git.proxmox.com Git - rustc.git/blob - tests/ui/structs-enums/classes-simple-method.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / 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 }