• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 extern crate proc_macro;
2 
3 use std::mem;
4 
5 #[rustversion::attr(before(1.32), ignore)]
6 #[test]
test_proc_macro_span_size()7 fn test_proc_macro_span_size() {
8     assert_eq!(mem::size_of::<proc_macro::Span>(), 4);
9     assert_eq!(mem::size_of::<Option<proc_macro::Span>>(), 4);
10 }
11 
12 #[cfg_attr(not(all(not(wrap_proc_macro), not(span_locations))), ignore)]
13 #[test]
test_proc_macro2_fallback_span_size_without_locations()14 fn test_proc_macro2_fallback_span_size_without_locations() {
15     assert_eq!(mem::size_of::<proc_macro2::Span>(), 0);
16     assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 1);
17 }
18 
19 #[cfg_attr(not(all(not(wrap_proc_macro), span_locations)), ignore)]
20 #[test]
test_proc_macro2_fallback_span_size_with_locations()21 fn test_proc_macro2_fallback_span_size_with_locations() {
22     assert_eq!(mem::size_of::<proc_macro2::Span>(), 8);
23     assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 12);
24 }
25 
26 #[rustversion::attr(before(1.32), ignore)]
27 #[rustversion::attr(
28     since(1.32),
29     cfg_attr(not(all(wrap_proc_macro, not(span_locations))), ignore)
30 )]
31 #[test]
test_proc_macro2_wrapper_span_size_without_locations()32 fn test_proc_macro2_wrapper_span_size_without_locations() {
33     assert_eq!(mem::size_of::<proc_macro2::Span>(), 4);
34     assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 8);
35 }
36 
37 #[cfg_attr(not(all(wrap_proc_macro, span_locations)), ignore)]
38 #[test]
test_proc_macro2_wrapper_span_size_with_locations()39 fn test_proc_macro2_wrapper_span_size_with_locations() {
40     assert_eq!(mem::size_of::<proc_macro2::Span>(), 12);
41     assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 12);
42 }
43