Debian Codegraph @

debian/rust-vendor/link-section/tests/expand-darwin/link_section.expanded.rs

raw
1 use link_section::{section, in_section, TypedSection};
2 #[allow(non_camel_case_types)]
3 struct FOO;
4 #[allow(non_snake_case)]
5 mod __FOO__link_sectionrs_L4_C8_H970cb50608f99e49__private_macro {
6 #[doc(hidden)]
7 pub use __FOO__link_sectionrs_L4_C8_H970cb50608f99e49__private_macro as __MACRO;
8 }
9 #[allow(unused_imports)]
10 #[doc(hidden)]
11 use __FOO__link_sectionrs_L4_C8_H970cb50608f99e49__private_macro::__MACRO as FOO;
12 impl FOO {
13 /// Get a `const` reference to the underlying section. In
14 /// non-const contexts, `deref` is sufficient.
15 pub const fn const_deref(&self) -> &'static TypedSection<fn()> {
16 static SECTION: TypedSection<fn()> = {
17 let section = {
18 ::link_section::__support::PtrBounds::new(
19 {
20 #[allow(missing_unsafe_on_extern)]
21 extern "C" {
22 #[link_name = "\u{1}section$start$__DATA$FOObh0r0BSfLQP"]
23 static __SYMBOL: u8;
24 }
25 unsafe { &raw const __SYMBOL as *const () }
26 },
27 {
28 #[allow(missing_unsafe_on_extern)]
29 extern "C" {
30 #[link_name = "\u{1}section$end$__DATA$FOObh0r0BSfLQP"]
31 static __SYMBOL: u8;
32 }
33 unsafe { &raw const __SYMBOL as *const () }
34 },
35 )
36 };
37 let name = "__DATA,FOObh0r0BSfLQP";
38 ::link_section::__support::validate_section_name(name);
39 unsafe { <TypedSection<fn()>>::new(name, section) }
40 };
41 &SECTION
42 }
43 }
44 impl ::core::fmt::Debug for FOO {
45 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
46 ::core::ops::Deref::deref(self).fmt(f)
47 }
48 }
49 impl ::core::ops::Deref for FOO {
50 type Target = TypedSection<fn()>;
51 fn deref(&self) -> &Self::Target {
52 self.const_deref()
53 }
54 }
55 impl ::link_section::__support::SectionItemType for FOO {
56 type Item = (fn());
57 }
58 impl ::link_section::__support::SectionItemTyped<(fn())> for FOO {
59 type Item = (fn());
60 }
61 impl FOO {
62 /// Get the section as a slice.
63 pub fn as_slice(&self) -> &[(fn())] {
64 self.const_deref().as_slice()
65 }
66 }
67 impl ::core::iter::IntoIterator for FOO {
68 type Item = &'static (fn());
69 type IntoIter = ::core::slice::Iter<'static, (fn())>;
70 fn into_iter(self) -> Self::IntoIter {
71 self.const_deref().as_slice().iter()
72 }
73 }
74 fn foo() {
75 const _: fn() = const {
76 type __InSecStoredTy = <FOO as ::link_section::__support::SectionItemType>::Item;
77 const __LINK_SECTION_CONST_ITEM_VALUE: __InSecStoredTy = foo;
78 #[used]
79 #[link_section = "__DATA,FOObh0r0BSfLQP,regular,no_dead_strip"]
80 static __LINK_SECTION_CONST_ITEM: __InSecStoredTy = __LINK_SECTION_CONST_ITEM_VALUE;
81 __LINK_SECTION_CONST_ITEM_VALUE
82 };
83 {
84 ::std::io::_print(format_args!("foo\n"));
85 };
86 }
87 fn main() {}