3 // Test argument patterns where we create refs to the inside of
4 // boxes. Make sure that we don't free the box as we match the
7 #![feature(box_patterns)]
9 fn getaddr(box ref x: Box<usize>) -> *const usize {
10 let addr: *const usize = &*x;
14 fn checkval(box ref x: Box<usize>) -> usize {
19 let obj: Box<_> = Box::new(1);
20 let objptr: *const usize = &*obj;
21 let xptr = getaddr(obj);
22 assert_eq!(objptr, xptr);
24 let obj = Box::new(22);
25 assert_eq!(checkval(obj), 22);