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