rust/tests/ui/tuple/tup.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
354 B
Rust
Raw Normal View History

//@ run-pass
#![allow(non_camel_case_types)]
type point = (isize, isize);
2011-08-15 11:39:45 +00:00
fn f(p: point, x: isize, y: isize) {
2011-08-15 11:39:45 +00:00
let (a, b) = p;
assert_eq!(a, x);
assert_eq!(b, y);
2011-08-15 11:39:45 +00:00
}
pub fn main() {
2011-08-15 11:39:45 +00:00
let p: point = (10, 20);
let (a, b) = p;
assert_eq!(a, 10);
assert_eq!(b, 20);
2011-08-15 11:39:45 +00:00
let p2: point = p;
f(p, 10, 20);
f(p2, 10, 20);
}