]> git.proxmox.com Git - rustc.git/blame - tests/ui/box/unit/unique-pat-2.rs
Merge 1.70 into proxmox/bookworm
[rustc.git] / tests / ui / box / unit / unique-pat-2.rs
CommitLineData
b7449926 1// run-pass
0bf4aa26 2#![allow(dead_code)]
b7449926
XL
3#![allow(non_camel_case_types)]
4#![allow(non_shorthand_field_patterns)]
c34b1796 5
85aaf69f 6#![feature(box_patterns)]
223e47cc 7
c34b1796 8struct Foo {a: isize, b: usize}
223e47cc 9
c34b1796 10enum bar { u(Box<Foo>), w(isize), }
223e47cc
LB
11
12pub fn main() {
c295e0f8
XL
13 let v = match bar::u(Box::new(Foo{ a: 10, b: 40 })) {
14 bar::u(box Foo{ a: a, b: b }) => { a + (b as isize) }
15 _ => { 66 }
16 };
17 assert_eq!(v, 50);
223e47cc 18}