]> Git Repo - binutils.git/blob - gdb/testsuite/gdb.rust/modules.rs
Update copyright year range in all GDB files.
[binutils.git] / gdb / testsuite / gdb.rust / modules.rs
1 // Copyright (C) 2016-2020 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 // See https://github.com/rust-lang/rust/pull/46457
25 #[no_mangle]
26 pub static TWENTY_THREE : u16 = 23;
27
28 pub struct Generic<T>(T);
29
30 pub struct Type;
31
32 pub mod mod1 {
33     pub struct Type(usize, isize);
34
35     pub mod inner {
36         pub struct Type(f64);
37
38         pub mod innest {
39             pub struct Type {pub x : u32}
40
41             fn wrap<T> (x: T) -> ::Generic<::Generic<T>> {
42                 ::Generic(::Generic(x))
43             }
44
45             pub fn f1 () {
46                 struct Type(i8);
47
48                 let x: u8 = 0;
49
50                 let ct = ::Type;
51                 let ctg = wrap(ct);
52                 let m1t = ::mod1::Type(23, 97);
53                 let m1tg = wrap(m1t);
54                 let innert = super::Type(10101.5);
55                 let innertg = wrap(innert);
56                 let innestt = self::Type{x: 0xfff};
57                 let innesttg = wrap(innestt);
58                 let f1t = Type(9);
59                 let f1tg = wrap(f1t);
60
61                 let f2 = || println!("lambda f2");
62
63                 let copy = ::TWENTY_THREE;
64
65                 f2();           // set breakpoint here
66                 f3();
67                 self::f2();
68                 super::f2();
69                 self::super::f2();
70                 self::super::super::f2();
71                 super::super::f2();
72                 ::f2();
73             }
74
75             pub fn f2() {
76                 println!("mod1::inner::innest::f2");
77             }
78
79             pub fn f3() {
80                 println!("mod1::inner::innest::f3");
81             }
82         }
83
84         pub fn f2() {
85             println!("mod1::inner::f2");
86         }
87     }
88
89     pub fn f2() {
90         println!("mod1::f2");
91     }
92 }
93
94 fn main () {
95     mod1::inner::innest::f1();
96 }
This page took 0.035251 seconds and 4 git commands to generate.