]> git.lizzy.rs Git - rust.git/blob - src/test/auxiliary/inner_static.rs
Auto merge of #22517 - brson:relnotes, r=Gankro
[rust.git] / src / test / auxiliary / inner_static.rs
1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 pub struct A<T>;
12 pub struct B<T>;
13
14 pub mod test {
15     pub struct A<T>;
16
17     impl<T> A<T> {
18         pub fn foo(&self) -> int {
19             static a: int = 5;
20             return a
21         }
22
23         pub fn bar(&self) -> int {
24             static a: int = 6;
25             return a;
26         }
27     }
28 }
29
30 impl<T> A<T> {
31     pub fn foo(&self) -> int {
32         static a: int = 1;
33         return a
34     }
35
36     pub fn bar(&self) -> int {
37         static a: int = 2;
38         return a;
39     }
40 }
41
42 impl<T> B<T> {
43     pub fn foo(&self) -> int {
44         static a: int = 3;
45         return a
46     }
47
48     pub fn bar(&self) -> int {
49         static a: int = 4;
50         return a;
51     }
52 }
53
54 pub fn foo() -> int {
55     let a = A::<()>;
56     let b = B::<()>;
57     let c = test::A::<()>;
58     return a.foo() + a.bar() +
59            b.foo() + b.bar() +
60            c.foo() + c.bar();
61 }