]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/explicit-self-generic.rs
Update ui tests
[rust.git] / src / test / ui / self / explicit-self-generic.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![feature(box_syntax)]
4
5 #[derive(Copy, Clone)]
6 struct LM { resize_at: usize, size: usize }
7
8 enum HashMap<K,V> {
9     HashMap_(LM, Vec<(K,V)>)
10 }
11
12 fn linear_map<K,V>() -> HashMap<K,V> {
13     HashMap::HashMap_(LM{
14         resize_at: 32,
15         size: 0}, Vec::new())
16 }
17
18 impl<K,V> HashMap<K,V> {
19     pub fn len(&mut self) -> usize {
20         match *self {
21             HashMap::HashMap_(ref l, _) => l.size
22         }
23     }
24 }
25
26 pub fn main() {
27     let mut m: Box<_> = box linear_map::<(),()>();
28     assert_eq!(m.len(), 0);
29 }