1// Copyright (C) 2016-2023 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 20fn f2() { 21 println!("::f2"); 22} 23 24// See https://github.com/rust-lang/rust/pull/46457 25#[no_mangle] 26pub static TWENTY_THREE : u16 = 23; 27 28pub struct Generic<T>(T); 29 30pub struct Type; 31 32pub 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 // Prevent linker from discarding symbol 64 let ptr: *const u16 = &::TWENTY_THREE; 65 66 f2(); // set breakpoint here 67 f3(); 68 self::f2(); 69 super::f2(); 70 self::super::f2(); 71 self::super::super::f2(); 72 super::super::f2(); 73 ::f2(); 74 } 75 76 pub fn f2() { 77 println!("mod1::inner::innest::f2"); 78 } 79 80 pub fn f3() { 81 println!("mod1::inner::innest::f3"); 82 } 83 } 84 85 pub fn f2() { 86 println!("mod1::inner::f2"); 87 } 88 } 89 90 pub fn f2() { 91 println!("mod1::f2"); 92 } 93} 94 95fn main () { 96 mod1::inner::innest::f1(); 97} 98