2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2019-07-26 21:54:25 +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); };
|
2021-08-25 00:39:40 +00:00
|
|
|
let w = Box::new(37);
|
2013-01-23 07:33:44 +00:00
|
|
|
frob(w);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2021-08-25 00:39:40 +00:00
|
|
|
let z = Box::new(17);
|
2013-01-23 07:33:44 +00:00
|
|
|
f(z);
|
|
|
|
g();
|
2013-02-14 19:47:00 +00:00
|
|
|
}
|