update copyright year range in GDB files
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.rust / modules.rs
1 // Copyright (C) 2016-2017 Free Software Foundation, Inc.
2
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 #![allow(dead_code)]
17 #![allow(unused_variables)]
18 #![allow(unused_assignments)]
19
20 fn f2() {
21 println!("::f2");
22 }
23
24 pub struct Generic<T>(T);
25
26 pub struct Type;
27
28 pub mod mod1 {
29 pub struct Type(usize, isize);
30
31 pub mod inner {
32 pub struct Type(f64);
33
34 pub mod innest {
35 pub struct Type {pub x : u32}
36
37 fn wrap<T> (x: T) -> ::Generic<::Generic<T>> {
38 ::Generic(::Generic(x))
39 }
40
41 pub fn f1 () {
42 struct Type(i8);
43
44 let x: u8 = 0;
45
46 let ct = ::Type;
47 let ctg = wrap(ct);
48 let m1t = ::mod1::Type(23, 97);
49 let m1tg = wrap(m1t);
50 let innert = super::Type(10101.5);
51 let innertg = wrap(innert);
52 let innestt = self::Type{x: 0xfff};
53 let innesttg = wrap(innestt);
54 let f1t = Type(9);
55 let f1tg = wrap(f1t);
56
57 let f2 = || println!("lambda f2");
58
59 f2(); // set breakpoint here
60 f3();
61 self::f2();
62 super::f2();
63 self::super::f2();
64 self::super::super::f2();
65 super::super::f2();
66 ::f2();
67 }
68
69 pub fn f2() {
70 println!("mod1::inner::innest::f2");
71 }
72
73 pub fn f3() {
74 println!("mod1::inner::innest::f3");
75 }
76 }
77
78 pub fn f2() {
79 println!("mod1::inner::f2");
80 }
81 }
82
83 pub fn f2() {
84 println!("mod1::f2");
85 }
86 }
87
88 fn main () {
89 mod1::inner::innest::f1();
90 }
This page took 0.033148 seconds and 4 git commands to generate.