1 #![cfg_attr(feature = "used_linker", feature(used_with_arg))] 2 3 use linkme as link_me; 4 5 mod declaration { 6 use crate::link_me::distributed_slice; 7 8 #[distributed_slice] 9 #[linkme(crate = crate::link_me)] 10 pub static SLICE: [i32] = [..]; 11 12 #[test] test_slice()13 fn test_slice() { 14 assert!(!SLICE.is_empty()); 15 } 16 17 #[distributed_slice] 18 #[linkme(crate = crate::link_me)] 19 pub static FUNCTIONS: [fn()] = [..]; 20 21 #[test] test_functions()22 fn test_functions() { 23 assert!(!FUNCTIONS.is_empty()); 24 } 25 } 26 27 mod usage { 28 use crate::link_me::distributed_slice; 29 30 #[distributed_slice(super::declaration::SLICE)] 31 #[linkme(crate = crate::link_me)] 32 pub static N: i32 = 9; 33 34 #[distributed_slice(super::declaration::FUNCTIONS)] 35 #[linkme(crate = crate::link_me)] test_me()36 fn test_me() {} 37 } 38