// -*- rust -*- type point = rec(int x, int y); type rect = tup(point, point); fn f(rect r, int x1, int y1, int x2, int y2) { check (r._0.x == x1); check (r._0.y == y1); check (r._1.x == x2); check (r._1.y == y2); } fn main() { let rect r = tup( rec(x=10, y=20), rec(x=11, y=22) ); check (r._0.x == 10); check (r._0.y == 20); check (r._1.x == 11); check (r._1.y == 22); let rect r2 = r; let int x = r2._0.x; check (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = rec(int x, int y); type rect = tup(point, point); fn f(rect r, int x1, int y1, int x2, int y2) { assert (r._0.x == x1); assert (r._0.y == y1); assert (r._1.x == x2); assert (r._1.y == y2); } fn main() { let rect r = tup( rec(x=10, y=20), rec(x=11, y=22) ); assert (r._0.x == 10); assert (r._0.y == 20); assert (r._1.x == 11); assert (r._1.y == 22); let rect r2 = r; let int x = r2._0.x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = rec(int x, int y); type rect = tup(point, point); fn f(rect r, int x1, int y1, int x2, int y2) { check (r._0.x == x1); check (r._0.y == y1); check (r._1.x == x2); check (r._1.y == y2); } fn main() { let rect r = tup( rec(x=10, y=20), rec(x=11, y=22) ); check (r._0.x == 10); check (r._0.y == 20); check (r._1.x == 11); check (r._1.y == 22); let rect r2 = r; let int x = r2._0.x; check (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = rec(int x, int y); type rect = tup(point, point); fn f(rect r, int x1, int y1, int x2, int y2) { assert (r._0.x == x1); assert (r._0.y == y1); assert (r._1.x == x2); assert (r._1.y == y2); } fn main() { let rect r = tup( rec(x=10, y=20), rec(x=11, y=22) ); assert (r._0.x == 10); assert (r._0.y == 20); assert (r._1.x == 11); assert (r._1.y == 22); let rect r2 = r; let int x = r2._0.x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = rec(int x, int y); type rect = tup(point, point); fn f(rect r, int x1, int y1, int x2, int y2) { assert (r._0.x == x1); assert (r._0.y == y1); assert (r._1.x == x2); assert (r._1.y == y2); } fn main() { let rect r = tup(rec(x=10, y=20), rec(x=11, y=22)); assert (r._0.x == 10); assert (r._0.y == 20); assert (r._1.x == 11); assert (r._1.y == 22); let rect r2 = r; let int x = r2._0.x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = {x: int, y: int}; type rect = (point, point); fn fst(r: &rect) -> point { let (fst, _) = r; ret fst; } fn snd(r: &rect) -> point { let (_, snd) = r; ret snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); assert (fst(r).y == y1); assert (snd(r).x == x2); assert (snd(r).y == y2); } fn main() { let r: rect = ({x: 10, y: 20}, {x: 11, y: 22}); assert (fst(r).x == 10); assert (fst(r).y == 20); assert (snd(r).x == 11); assert (snd(r).y == 22); let r2 = r; let x: int = fst(r2).x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = {x: int, y: int}; type rect = (point, point); fn fst(r: &rect) -> point { let (fst, _) = r; ret fst; } fn snd(r: &rect) -> point { let (_, snd) = r; ret snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); assert (fst(r).y == y1); assert (snd(r).x == x2); assert (snd(r).y == y2); } fn main() { let r: rect = ({x: 10, y: 20}, {x: 11, y: 22}); assert (fst(r).x == 10); assert (fst(r).y == 20); assert (snd(r).x == 11); assert (snd(r).y == 22); let r2 = r; let x: int = fst(r2).x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = {x: int, y: int}; type rect = (point, point); fn fst(r: rect) -> point { let (fst, _) = r; ret fst; } fn snd(r: rect) -> point { let (_, snd) = r; ret snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); assert (fst(r).y == y1); assert (snd(r).x == x2); assert (snd(r).y == y2); } fn main() { let r: rect = ({x: 10, y: 20}, {x: 11, y: 22}); assert (fst(r).x == 10); assert (fst(r).y == 20); assert (snd(r).x == 11); assert (snd(r).y == 22); let r2 = r; let x: int = fst(r2).x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- type point = {x: int, y: int}; type rect = (point, point); fn fst(r: rect) -> point { let (fst, _) = r; return fst; } fn snd(r: rect) -> point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); assert (fst(r).y == y1); assert (snd(r).x == x2); assert (snd(r).y == y2); } fn main() { let r: rect = ({x: 10, y: 20}, {x: 11, y: 22}); assert (fst(r).x == 10); assert (fst(r).y == 20); assert (snd(r).x == 11); assert (snd(r).y == 22); let r2 = r; let x: int = fst(r2).x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. type point = {x: int, y: int}; type rect = (point, point); fn fst(r: rect) -> point { let (fst, _) = r; return fst; } fn snd(r: rect) -> point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); assert (fst(r).y == y1); assert (snd(r).x == x2); assert (snd(r).y == y2); } fn main() { let r: rect = ({x: 10, y: 20}, {x: 11, y: 22}); assert (fst(r).x == 10); assert (fst(r).y == 20); assert (snd(r).x == 11); assert (snd(r).y == 22); let r2 = r; let x: int = fst(r2).x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); assert (fst(r).y == y1); assert (snd(r).x == x2); assert (snd(r).y == y2); } fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert (fst(r).x == 10); assert (fst(r).y == 20); assert (snd(r).x == 11); assert (snd(r).y == 22); let r2 = r; let x: int = fst(r2).x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); assert (fst(r).y == y1); assert (snd(r).x == x2); assert (snd(r).y == y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert (fst(r).x == 10); assert (fst(r).y == 20); assert (snd(r).x == 11); assert (snd(r).y == 22); let r2 = r; let x: int = fst(r2).x; assert (x == 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { fail_unless!((fst(r).x == x1)); fail_unless!((fst(r).y == y1)); fail_unless!((snd(r).x == x2)); fail_unless!((snd(r).y == y2)); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); fail_unless!((fst(r).x == 10)); fail_unless!((fst(r).y == 20)); fail_unless!((snd(r).x == 11)); fail_unless!((snd(r).y == 22)); let r2 = r; let x: int = fst(r2).x; fail_unless!((x == 10)); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert!((fst(r).x == x1)); assert!((fst(r).y == y1)); assert!((snd(r).x == x2)); assert!((snd(r).y == y2)); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert!((fst(r).x == 10)); assert!((fst(r).y == 20)); assert!((snd(r).x == 11)); assert!((snd(r).y == 22)); let r2 = r; let x: int = fst(r2).x; assert!((x == 10)); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // -*- rust -*- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: int = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: int = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct Point {x: int, y: int} impl Copy for Point {} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: int = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #[derive(Copy)] struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: int = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // pretty-expanded FIXME #23616 #[derive(Copy)] struct Point {x: int, y: int} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: int = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // pretty-expanded FIXME #23616 #[derive(Copy)] struct Point {x: isize, y: isize} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: isize, y1: isize, x2: isize, y2: isize) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: isize = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // pretty-expanded FIXME #23616 #[derive(Copy, Clone)] struct Point {x: isize, y: isize} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: isize, y1: isize, x2: isize, y2: isize) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: isize = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #[derive(Copy, Clone)] struct Point {x: isize, y: isize} type rect = (Point, Point); fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } fn f(r: rect, x1: isize, y1: isize, x2: isize, y2: isize) { assert_eq!(fst(r).x, x1); assert_eq!(fst(r).y, y1); assert_eq!(snd(r).x, x2); assert_eq!(snd(r).y, y2); } pub fn main() { let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); assert_eq!(fst(r).x, 10); assert_eq!(fst(r).y, 20); assert_eq!(snd(r).x, 11); assert_eq!(snd(r).y, 22); let r2 = r; let x: isize = fst(r2).x; assert_eq!(x, 10); f(r, 10, 20, 11, 22); f(r2, 10, 20, 11, 22); }