1 // Assumes proc-macro2's "span-locations" feature is off.
2
3 use std::mem;
4 use syn::{Expr, Item, Lit, Pat, Type};
5
6 #[rustversion::attr(before(2022-11-24), ignore = "requires nightly-2022-11-24 or newer")]
7 #[rustversion::attr(
8 since(2022-11-24),
9 cfg_attr(not(target_pointer_width = "64"), ignore = "only applicable to 64-bit")
10 )]
11 #[test]
test_expr_size()12 fn test_expr_size() {
13 assert_eq!(mem::size_of::<Expr>(), 176);
14 }
15
16 #[rustversion::attr(before(2022-09-09), ignore = "requires nightly-2022-09-09 or newer")]
17 #[rustversion::attr(
18 since(2022-09-09),
19 cfg_attr(not(target_pointer_width = "64"), ignore = "only applicable to 64-bit")
20 )]
21 #[test]
test_item_size()22 fn test_item_size() {
23 assert_eq!(mem::size_of::<Item>(), 352);
24 }
25
26 #[rustversion::attr(before(2023-04-29), ignore = "requires nightly-2023-04-29 or newer")]
27 #[rustversion::attr(
28 since(2023-04-29),
29 cfg_attr(not(target_pointer_width = "64"), ignore = "only applicable to 64-bit")
30 )]
31 #[test]
test_type_size()32 fn test_type_size() {
33 assert_eq!(mem::size_of::<Type>(), 224);
34 }
35
36 #[rustversion::attr(before(2023-04-29), ignore = "requires nightly-2023-04-29 or newer")]
37 #[rustversion::attr(
38 since(2023-04-29),
39 cfg_attr(not(target_pointer_width = "64"), ignore = "only applicable to 64-bit")
40 )]
41 #[test]
test_pat_size()42 fn test_pat_size() {
43 assert_eq!(mem::size_of::<Pat>(), 184);
44 }
45
46 #[rustversion::attr(before(2023-12-20), ignore = "requires nightly-2023-12-20 or newer")]
47 #[rustversion::attr(
48 since(2023-12-20),
49 cfg_attr(not(target_pointer_width = "64"), ignore = "only applicable to 64-bit")
50 )]
51 #[test]
test_lit_size()52 fn test_lit_size() {
53 assert_eq!(mem::size_of::<Lit>(), 24);
54 }
55