2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn f(mut y: Box<isize>) {
|
2013-01-22 23:33:44 -08:00
|
|
|
*y = 5;
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(*y, 5);
|
2013-01-22 23:33:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn g() {
|
2015-06-07 21:00:38 +03:00
|
|
|
let frob = |mut q: Box<isize>| { *q = 2; assert_eq!(*q, 2); };
|
2021-08-25 02:39:40 +02:00
|
|
|
let w = Box::new(37);
|
2013-01-22 23:33:44 -08:00
|
|
|
frob(w);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2021-08-25 02:39:40 +02:00
|
|
|
let z = Box::new(17);
|
2013-01-22 23:33:44 -08:00
|
|
|
f(z);
|
|
|
|
g();
|
2013-02-14 11:47:00 -08:00
|
|
|
}
|