2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
|
|
|
|
2015-01-07 19:25:56 -06:00
|
|
|
#![feature(box_syntax)]
|
2014-05-05 20:56:44 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
fn f(mut y: Box<isize>) {
|
2013-01-23 01:33:44 -06:00
|
|
|
*y = 5;
|
2013-05-18 21:02:45 -05:00
|
|
|
assert_eq!(*y, 5);
|
2013-01-23 01:33:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn g() {
|
2015-06-07 13:00:38 -05:00
|
|
|
let frob = |mut q: Box<isize>| { *q = 2; assert_eq!(*q, 2); };
|
2014-05-05 20:56:44 -05:00
|
|
|
let w = box 37;
|
2013-01-23 01:33:44 -06:00
|
|
|
frob(w);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2014-05-05 20:56:44 -05:00
|
|
|
let z = box 17;
|
2013-01-23 01:33:44 -06:00
|
|
|
f(z);
|
|
|
|
g();
|
2013-02-14 13:47:00 -06:00
|
|
|
}
|