mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
19 lines
260 B
Rust
19 lines
260 B
Rust
//@ run-pass
|
|
|
|
fn f(mut y: Box<isize>) {
|
|
*y = 5;
|
|
assert_eq!(*y, 5);
|
|
}
|
|
|
|
fn g() {
|
|
let frob = |mut q: Box<isize>| { *q = 2; assert_eq!(*q, 2); };
|
|
let w = Box::new(37);
|
|
frob(w);
|
|
|
|
}
|
|
|
|
pub fn main() {
|
|
let z = Box::new(17);
|
|
f(z);
|
|
g();
|
|
}
|