2019-07-26 21:54:25 +00:00
|
|
|
// run-pass
|
|
|
|
|
2013-02-23 00:08:16 +00:00
|
|
|
fn f(arg: &mut A) {
|
2011-09-12 11:13:20 +00:00
|
|
|
arg.a = 100;
|
|
|
|
}
|
|
|
|
|
2015-03-30 13:38:27 +00:00
|
|
|
#[derive(Copy, Clone)]
|
2015-03-26 00:06:52 +00:00
|
|
|
struct A { a: isize }
|
2013-01-26 06:46:32 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2013-02-23 00:08:16 +00:00
|
|
|
let mut x = A {a: 10};
|
|
|
|
f(&mut x);
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(x.a, 100);
|
2011-09-12 11:13:20 +00:00
|
|
|
x.a = 20;
|
2013-06-28 00:41:35 +00:00
|
|
|
let mut y = x;
|
2013-02-23 00:08:16 +00:00
|
|
|
f(&mut y);
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(x.a, 20);
|
2011-09-12 11:13:20 +00:00
|
|
|
}
|