summaryrefslogtreecommitdiffstats
path: root/tests/test_size.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:40:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:40:32 +0000
commit86cc98ac45d2fe735c5103cb89040db0e159e1f5 (patch)
treeb32ea97ff2eef869149f1750a0e6f55c9fcff65c /tests/test_size.rs
parentReleasing progress-linux version 1.0.81-1~progress7.99u1. (diff)
downloadrust-proc-macro2-86cc98ac45d2fe735c5103cb89040db0e159e1f5.tar.xz
rust-proc-macro2-86cc98ac45d2fe735c5103cb89040db0e159e1f5.zip
Merging upstream version 1.0.85.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/test_size.rs89
1 files changed, 77 insertions, 12 deletions
diff --git a/tests/test_size.rs b/tests/test_size.rs
index 46e58db..49ca68e 100644
--- a/tests/test_size.rs
+++ b/tests/test_size.rs
@@ -2,41 +2,106 @@ extern crate proc_macro;
use std::mem;
-#[rustversion::attr(before(1.32), ignore)]
+#[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_span_size() {
+fn test_proc_macro_size() {
assert_eq!(mem::size_of::<proc_macro::Span>(), 4);
assert_eq!(mem::size_of::<Option<proc_macro::Span>>(), 4);
+ assert_eq!(mem::size_of::<proc_macro::Group>(), 20);
+ assert_eq!(mem::size_of::<proc_macro::Ident>(), 12);
+ assert_eq!(mem::size_of::<proc_macro::Punct>(), 8);
+ assert_eq!(mem::size_of::<proc_macro::Literal>(), 16);
+ assert_eq!(mem::size_of::<proc_macro::TokenStream>(), 4);
}
-#[cfg_attr(not(all(not(wrap_proc_macro), not(span_locations))), ignore)]
+#[cfg_attr(
+ any(
+ randomize_layout,
+ not(target_pointer_width = "64"),
+ wrap_proc_macro,
+ span_locations
+ ),
+ ignore
+)]
#[test]
-fn test_proc_macro2_fallback_span_size_without_locations() {
+fn test_proc_macro2_fallback_size_without_locations() {
assert_eq!(mem::size_of::<proc_macro2::Span>(), 0);
assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 1);
+ assert_eq!(mem::size_of::<proc_macro2::Group>(), 16);
+ assert_eq!(mem::size_of::<proc_macro2::Ident>(), 24);
+ assert_eq!(mem::size_of::<proc_macro2::Punct>(), 8);
+ assert_eq!(mem::size_of::<proc_macro2::Literal>(), 24);
+ assert_eq!(mem::size_of::<proc_macro2::TokenStream>(), 8);
}
-#[cfg_attr(not(all(not(wrap_proc_macro), span_locations)), ignore)]
+#[cfg_attr(
+ any(
+ randomize_layout,
+ not(target_pointer_width = "64"),
+ wrap_proc_macro,
+ not(span_locations)
+ ),
+ ignore
+)]
#[test]
-fn test_proc_macro2_fallback_span_size_with_locations() {
+fn test_proc_macro2_fallback_size_with_locations() {
assert_eq!(mem::size_of::<proc_macro2::Span>(), 8);
assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 12);
+ assert_eq!(mem::size_of::<proc_macro2::Group>(), 24);
+ assert_eq!(mem::size_of::<proc_macro2::Ident>(), 32);
+ assert_eq!(mem::size_of::<proc_macro2::Punct>(), 16);
+ assert_eq!(mem::size_of::<proc_macro2::Literal>(), 32);
+ assert_eq!(mem::size_of::<proc_macro2::TokenStream>(), 8);
}
-#[rustversion::attr(before(1.32), ignore)]
+#[rustversion::attr(before(1.71), ignore)]
#[rustversion::attr(
- since(1.32),
- cfg_attr(not(all(wrap_proc_macro, not(span_locations))), ignore)
+ 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_span_size_without_locations() {
+fn test_proc_macro2_wrapper_size_without_locations() {
assert_eq!(mem::size_of::<proc_macro2::Span>(), 4);
assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 8);
+ assert_eq!(mem::size_of::<proc_macro2::Group>(), 24);
+ assert_eq!(mem::size_of::<proc_macro2::Ident>(), 24);
+ assert_eq!(mem::size_of::<proc_macro2::Punct>(), 12);
+ assert_eq!(mem::size_of::<proc_macro2::Literal>(), 24);
+ assert_eq!(mem::size_of::<proc_macro2::TokenStream>(), 32);
}
-#[cfg_attr(not(all(wrap_proc_macro, span_locations)), ignore)]
+#[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_span_size_with_locations() {
+fn test_proc_macro2_wrapper_size_with_locations() {
assert_eq!(mem::size_of::<proc_macro2::Span>(), 12);
assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 12);
+ assert_eq!(mem::size_of::<proc_macro2::Group>(), 32);
+ assert_eq!(mem::size_of::<proc_macro2::Ident>(), 32);
+ assert_eq!(mem::size_of::<proc_macro2::Punct>(), 20);
+ assert_eq!(mem::size_of::<proc_macro2::Literal>(), 32);
+ assert_eq!(mem::size_of::<proc_macro2::TokenStream>(), 32);
}