]> git.lizzy.rs Git - rust.git/blob - tests/source/impls.rs
Fix #1259 (#1263)
[rust.git] / tests / source / impls.rs
1 impl Foo for Bar { fn foo() { "hi" } }
2
3 pub impl Foo for Bar {
4     // Associated Constants
5     const   Baz:   i32 =   16;
6     // Associated Types
7     type   FooBar  =   usize;
8     // Comment 1
9     fn foo() { "hi" }
10     // Comment 2
11     fn foo() { "hi" }
12     // Comment 3
13 }
14
15 pub unsafe impl<'a, 'b, X, Y: Foo<Bar>> !Foo<'a, X> for Bar<'b, Y> where X: Foo<'a, Z> {
16     fn foo() { "hi" }    
17 }
18
19 impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y> where X: Fooooooooooooooooooooooooooooo<'a, Z>
20 {
21     fn foo() { "hi" }    
22 }
23
24 impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y> where X: Foooooooooooooooooooooooooooo<'a, Z>
25 {
26     fn foo() { "hi" }    
27 }
28
29 impl<T> Foo for Bar<T> where T: Baz 
30 {
31 }
32
33 impl<T> Foo for Bar<T> where T: Baz { /* Comment */ }
34
35 impl Foo {
36     fn foo() {}
37 }
38
39 impl Boo {
40
41     // BOO
42     fn boo() {}
43     // FOO
44
45     
46     
47 }
48
49 mod a {
50     impl Foo {
51         // Hello!
52         fn foo() {}
53     }
54 }
55
56
57 mod b {
58     mod a {
59         impl Foo {
60             fn foo() {}
61         }
62     }
63 }
64
65 impl Foo { add_fun!(); }
66
67 impl Blah {
68     fn boop() {}
69     add_fun!();
70 }
71
72 impl X { fn do_parse(  mut  self : X ) {} }
73
74 impl Y5000 {
75     fn bar(self: X< 'a ,  'b >, y: Y) {}
76
77     fn bad(&self, ( x, y): CoorT) {}
78
79     fn turbo_bad(self: X< 'a ,  'b >  , ( x, y): CoorT) {
80         
81     }
82 }
83
84 pub impl<T> Foo for Bar<T> where T: Foo
85 {
86     fn foo() { "hi" }
87 }
88
89 pub impl<T, Z> Foo for Bar<T, Z> where T: Foo, Z: Baz {}
90
91 mod m {
92     impl<T> PartialEq for S<T> where T: PartialEq {
93         fn eq(&self, other: &Self) {
94             true
95         }
96       }
97
98         impl<T> PartialEq for S<T> where T: PartialEq {      }
99  }
100
101 impl<BorrowType, K, V, NodeType, HandleType> Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
102 }
103
104 impl<BorrowType, K, V, NodeType, HandleType> PartialEq for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
105 }
106
107 mod x {
108     impl<A, B, C, D> Foo
109         where A: 'static,
110               B: 'static,
111               C: 'static,
112               D: 'static { }
113 }