extern crate proc_macro; use std::mem; #[rustversion::attr(before(1.64), ignore)] #[rustversion::attr( since(1.64), cfg_attr(any(randomize_layout, not(target_pointer_width = "64")), ignore) )] #[test] fn test_proc_macro_size() { assert_eq!(mem::size_of::(), 4); assert_eq!(mem::size_of::>(), 4); assert_eq!(mem::size_of::(), 20); assert_eq!(mem::size_of::(), 12); assert_eq!(mem::size_of::(), 8); assert_eq!(mem::size_of::(), 16); assert_eq!(mem::size_of::(), 4); } #[cfg_attr( any( randomize_layout, not(target_pointer_width = "64"), wrap_proc_macro, span_locations ), ignore )] #[test] fn test_proc_macro2_fallback_size_without_locations() { assert_eq!(mem::size_of::(), 0); assert_eq!(mem::size_of::>(), 1); assert_eq!(mem::size_of::(), 16); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 8); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 8); } #[cfg_attr( any( randomize_layout, not(target_pointer_width = "64"), wrap_proc_macro, not(span_locations) ), ignore )] #[test] fn test_proc_macro2_fallback_size_with_locations() { assert_eq!(mem::size_of::(), 8); assert_eq!(mem::size_of::>(), 12); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 16); assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 8); } #[rustversion::attr(before(1.71), ignore)] #[rustversion::attr( since(1.71), cfg_attr( any( randomize_layout, not(target_pointer_width = "64"), not(wrap_proc_macro), span_locations ), ignore ) )] #[test] fn test_proc_macro2_wrapper_size_without_locations() { assert_eq!(mem::size_of::(), 4); assert_eq!(mem::size_of::>(), 8); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 12); assert_eq!(mem::size_of::(), 24); assert_eq!(mem::size_of::(), 32); } #[rustversion::attr(before(1.65), ignore)] #[rustversion::attr( since(1.65), cfg_attr( any( randomize_layout, not(target_pointer_width = "64"), not(wrap_proc_macro), not(span_locations) ), ignore ) )] #[test] fn test_proc_macro2_wrapper_size_with_locations() { assert_eq!(mem::size_of::(), 12); assert_eq!(mem::size_of::>(), 12); assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 20); assert_eq!(mem::size_of::(), 32); assert_eq!(mem::size_of::(), 32); }