2019-07-27 00:54:25 +03:00
|
|
|
//@ run-pass
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
struct Point(isize, isize);
|
2014-08-10 15:54:33 +12:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x = Point(3, 2);
|
|
|
|
assert_eq!(x.0, 3);
|
|
|
|
assert_eq!(x.1, 2);
|
|
|
|
x.0 += 5;
|
|
|
|
assert_eq!(x.0, 8);
|
|
|
|
{
|
|
|
|
let ry = &mut x.1;
|
|
|
|
*ry -= 2;
|
|
|
|
x.0 += 3;
|
|
|
|
assert_eq!(x.0, 11);
|
|
|
|
}
|
|
|
|
assert_eq!(x.1, 0);
|
|
|
|
|
2015-01-25 22:05:03 +01:00
|
|
|
let mut x = (3, 2);
|
2014-08-10 15:54:33 +12:00
|
|
|
assert_eq!(x.0, 3);
|
|
|
|
assert_eq!(x.1, 2);
|
|
|
|
x.0 += 5;
|
|
|
|
assert_eq!(x.0, 8);
|
|
|
|
{
|
|
|
|
let ry = &mut x.1;
|
|
|
|
*ry -= 2;
|
|
|
|
x.0 += 3;
|
|
|
|
assert_eq!(x.0, 11);
|
|
|
|
}
|
|
|
|
assert_eq!(x.1, 0);
|
|
|
|
|
|
|
|
}
|