]> git.lizzy.rs Git - rust.git/blob - tests/ui/newtype.rs
Make `output_filenames` a real query
[rust.git] / tests / ui / newtype.rs
1 // run-pass
2
3 #![allow(non_camel_case_types)]
4 #[derive(Copy, Clone)]
5 struct mytype(Mytype);
6
7 #[derive(Copy, Clone)]
8 struct Mytype {
9     compute: fn(mytype) -> isize,
10     val: isize,
11 }
12
13 fn compute(i: mytype) -> isize {
14     let mytype(m) = i;
15     return m.val + 20;
16 }
17
18 pub fn main() {
19     let myval = mytype(Mytype{compute: compute, val: 30});
20     println!("{}", compute(myval));
21     let mytype(m) = myval;
22     assert_eq!((m.compute)(myval), 50);
23 }