1 #![cfg_attr(feature = "used_linker", feature(used_with_arg))] 2 #![allow(clippy::needless_lifetimes, clippy::trivially_copy_pass_by_ref)] 3 4 use linkme::distributed_slice; 5 6 #[distributed_slice] 7 pub static SLICE1: [fn()] = [..]; 8 9 #[distributed_slice(SLICE1)] foo()10fn foo() {} 11 12 #[distributed_slice] 13 pub static SLICE2: [for<'a, 'b> fn(&'a &'b ())] = [..]; 14 15 #[distributed_slice(SLICE2)] bar<'a, 'b>(_: &'a &'b ())16fn bar<'a, 'b>(_: &'a &'b ()) {} 17 18 #[distributed_slice] 19 pub static SLICE3: [unsafe extern "C" fn() -> i32] = [..]; 20 21 #[distributed_slice(SLICE3)] baz() -> i3222unsafe extern "C" fn baz() -> i32 { 23 42 24 } 25 26 #[test] test_slices()27fn test_slices() { 28 assert!(!SLICE1.is_empty()); 29 assert!(!SLICE2.is_empty()); 30 assert!(!SLICE3.is_empty()); 31 } 32