Skip to content

Commit

Permalink
Make size tests #[ignore] in cfg(randomize_layout)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 2, 2024
1 parent 33c9578 commit 1160ec3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/test_size.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#![cfg(not(randomize_layout))]

extern crate proc_macro;

use std::mem;

#[rustversion::attr(before(1.64), ignore)]
#[rustversion::attr(since(1.64), cfg_attr(randomize_layout, ignore))]
#[test]
fn test_proc_macro_size() {
assert_eq!(mem::size_of::<proc_macro::Span>(), 4);
Expand All @@ -16,7 +15,7 @@ fn test_proc_macro_size() {
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, 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 @@ -28,7 +27,7 @@ fn test_proc_macro2_fallback_size_without_locations() {
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, 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 @@ -43,7 +42,7 @@ fn test_proc_macro2_fallback_size_with_locations() {
#[rustversion::attr(before(1.71), ignore)]
#[rustversion::attr(
since(1.71),
cfg_attr(not(all(wrap_proc_macro, not(span_locations))), ignore)
cfg_attr(any(randomize_layout, not(wrap_proc_macro), span_locations), ignore)
)]
#[test]
fn test_proc_macro2_wrapper_size_without_locations() {
Expand All @@ -59,7 +58,10 @@ fn test_proc_macro2_wrapper_size_without_locations() {
#[rustversion::attr(before(1.65), ignore)]
#[rustversion::attr(
since(1.65),
cfg_attr(not(all(wrap_proc_macro, span_locations)), ignore)
cfg_attr(
any(randomize_layout, not(wrap_proc_macro), not(span_locations)),
ignore
)
)]
#[test]
fn test_proc_macro2_wrapper_size_with_locations() {
Expand Down

0 comments on commit 1160ec3

Please sign in to comment.