]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/tuple-index.rs
Remove the in-tree `flate` crate
[rust.git] / src / test / run-pass / tuple-index.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11
12 struct Point(isize, isize);
13
14 fn main() {
15     let mut x = Point(3, 2);
16     assert_eq!(x.0, 3);
17     assert_eq!(x.1, 2);
18     x.0 += 5;
19     assert_eq!(x.0, 8);
20     {
21         let ry = &mut x.1;
22         *ry -= 2;
23         x.0 += 3;
24         assert_eq!(x.0, 11);
25     }
26     assert_eq!(x.1, 0);
27
28     let mut x = (3, 2);
29     assert_eq!(x.0, 3);
30     assert_eq!(x.1, 2);
31     x.0 += 5;
32     assert_eq!(x.0, 8);
33     {
34         let ry = &mut x.1;
35         *ry -= 2;
36         x.0 += 3;
37         assert_eq!(x.0, 11);
38     }
39     assert_eq!(x.1, 0);
40
41 }