Skip to content

Commit

Permalink
Account for proc_macro::Span layout change between 1.31 and 1.32
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 11, 2023
1 parent 6083bef commit e1fa732
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ unicode-ident = "1.0"

[dev-dependencies]
quote = { version = "1.0", default_features = false }
rustversion = "1"

[features]
proc-macro = []
Expand Down
2 changes: 2 additions & 0 deletions tests/test_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extern crate proc_macro;

use std::mem;

#[rustversion::attr(before(1.32), ignore)]
#[test]
fn test_proc_macro_span_size() {
assert_eq!(mem::size_of::<proc_macro::Span>(), 4);
Expand All @@ -22,6 +23,7 @@ fn test_proc_macro2_fallback_span_size_with_locations() {
assert_eq!(mem::size_of::<Option<proc_macro2::Span>>(), 12);
}

#[rustversion::attr(before(1.32), ignore)]
#[cfg_attr(not(all(wrap_proc_macro, not(span_locations))), ignore)]
#[test]
fn test_proc_macro2_wrapper_span_size_without_locations() {
Expand Down

0 comments on commit e1fa732

Please sign in to comment.