]> git.proxmox.com Git - rustc.git/blame - src/test/ui/structs-enums/record-pat.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / structs-enums / record-pat.rs
CommitLineData
b7449926
XL
1// run-pass
2#![allow(non_camel_case_types)]
3#![allow(non_shorthand_field_patterns)]
223e47cc 4
c34b1796
AL
5enum t1 { a(isize), b(usize), }
6struct T2 {x: t1, y: isize}
7enum t3 { c(T2, usize), }
8
9fn m(input: t3) -> isize {
1a4d82fc
JJ
10 match input {
11 t3::c(T2 {x: t1::a(m), ..}, _) => { return m; }
c34b1796 12 t3::c(T2 {x: t1::b(m), y: y}, z) => { return ((m + z) as isize) + y; }
223e47cc
LB
13 }
14}
15
16pub fn main() {
c34b1796
AL
17 assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4)), 10);
18 assert_eq!(m(t3::c(T2 {x: t1::b(10), y: 5}, 4)), 19);
223e47cc 19}