]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-12860.rs
Enable full revision in const generics ui tests
[rust.git] / src / test / ui / issues / issue-12860.rs
1 // run-pass
2 use std::collections::HashSet;
3
4 #[derive(Copy, Clone, PartialEq, Eq, Hash)]
5 struct XYZ {
6     x: isize,
7     y: isize,
8     z: isize
9 }
10
11 fn main() {
12     let mut connected = HashSet::new();
13     let mut border = HashSet::new();
14
15     let middle = XYZ{x: 0, y: 0, z: 0};
16     border.insert(middle);
17
18     while !border.is_empty() && connected.len() < 10000 {
19         let choice = *(border.iter().next().unwrap());
20         border.remove(&choice);
21         connected.insert(choice);
22
23         let cxp = XYZ{x: choice.x + 1, y: choice.y, z: choice.z};
24         let cxm = XYZ{x: choice.x - 1, y: choice.y, z: choice.z};
25         let cyp = XYZ{x: choice.x, y: choice.y + 1, z: choice.z};
26         let cym = XYZ{x: choice.x, y: choice.y - 1, z: choice.z};
27         let czp = XYZ{x: choice.x, y: choice.y, z: choice.z + 1};
28         let czm = XYZ{x: choice.x, y: choice.y, z: choice.z - 1};
29
30         if !connected.contains(&cxp) {
31             border.insert(cxp);
32         }
33         if  !connected.contains(&cxm){
34             border.insert(cxm);
35         }
36         if !connected.contains(&cyp){
37             border.insert(cyp);
38         }
39         if !connected.contains(&cym) {
40             border.insert(cym);
41         }
42         if !connected.contains(&czp){
43             border.insert(czp);
44         }
45         if !connected.contains(&czm) {
46             border.insert(czm);
47         }
48     }
49 }