Skip to content

Commit

Permalink
Merge pull request #464 from dtolnay/testsize
Browse files Browse the repository at this point in the history
Ignore size tests on non-64bit target
  • Loading branch information
dtolnay authored Jun 2, 2024
2 parents 1160ec3 + bc9f4d9 commit aa64c20
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions tests/test_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ extern crate proc_macro;
use std::mem;

#[rustversion::attr(before(1.64), ignore)]
#[rustversion::attr(since(1.64), cfg_attr(randomize_layout, 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::<proc_macro::Span>(), 4);
Expand All @@ -15,7 +18,15 @@ fn test_proc_macro_size() {
assert_eq!(mem::size_of::<proc_macro::TokenStream>(), 4);
}

#[cfg_attr(any(randomize_layout, wrap_proc_macro, 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_size_without_locations() {
assert_eq!(mem::size_of::<proc_macro2::Span>(), 0);
Expand All @@ -27,7 +38,15 @@ fn test_proc_macro2_fallback_size_without_locations() {
assert_eq!(mem::size_of::<proc_macro2::TokenStream>(), 8);
}

#[cfg_attr(any(randomize_layout, wrap_proc_macro, not(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_size_with_locations() {
assert_eq!(mem::size_of::<proc_macro2::Span>(), 8);
Expand All @@ -42,7 +61,15 @@ fn test_proc_macro2_fallback_size_with_locations() {
#[rustversion::attr(before(1.71), ignore)]
#[rustversion::attr(
since(1.71),
cfg_attr(any(randomize_layout, not(wrap_proc_macro), span_locations), ignore)
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() {
Expand All @@ -59,7 +86,12 @@ fn test_proc_macro2_wrapper_size_without_locations() {
#[rustversion::attr(
since(1.65),
cfg_attr(
any(randomize_layout, not(wrap_proc_macro), not(span_locations)),
any(
randomize_layout,
not(target_pointer_width = "64"),
not(wrap_proc_macro),
not(span_locations)
),
ignore
)
)]
Expand Down

0 comments on commit aa64c20

Please sign in to comment.