]> git.proxmox.com Git - rustc.git/blob - src/test/ui/unsized-tuple-impls.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / test / ui / unsized-tuple-impls.rs
1 // run-pass
2
3 #![feature(unsized_tuple_coercion)]
4
5 use std::collections::HashSet;
6
7 fn main() {
8 let x : &(i32, i32, [i32]) = &(0, 1, [2, 3]);
9 let y : &(i32, i32, [i32]) = &(0, 1, [2, 3, 4]);
10 let mut a = [y, x];
11 a.sort();
12 assert_eq!(a, [x, y]);
13
14 assert_eq!(&format!("{:?}", a), "[(0, 1, [2, 3]), (0, 1, [2, 3, 4])]");
15
16 let mut h = HashSet::new();
17 h.insert(x);
18 h.insert(y);
19 assert!(h.contains(x));
20 assert!(h.contains(y));
21 }