]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs-enums/class-typarams.rs
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
[rust.git] / src / test / ui / structs-enums / class-typarams.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(non_camel_case_types)]
4
5 // pretty-expanded FIXME #23616
6
7 use std::marker::PhantomData;
8
9 struct cat<U> {
10     meows : usize,
11     how_hungry : isize,
12     m: PhantomData<U>
13 }
14
15 impl<U> cat<U> {
16     pub fn speak(&mut self) { self.meows += 1; }
17     pub fn meow_count(&mut self) -> usize { self.meows }
18 }
19
20 fn cat<U>(in_x : usize, in_y : isize) -> cat<U> {
21     cat {
22         meows: in_x,
23         how_hungry: in_y,
24         m: PhantomData
25     }
26 }
27
28
29 pub fn main() {
30   let _nyan : cat<isize> = cat::<isize>(52, 99);
31   //  let mut kitty = cat(1000, 2);
32 }