Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newly added test_size::test_proc_macro2_wrapper_size_without_locations test fails on i686 #463

Closed
decathorpe opened this issue May 28, 2024 · 2 comments · Fixed by #464
Closed

Comments

@decathorpe
Copy link

I noticed that the proc-macro2 crate's test suite started to fail on Fedora Linux - from the build logs:

     Running `/builddir/build/BUILD/proc-macro2-1.0.84/target/rpm/deps/test_size-05b53b4047993840 --skip src/lib.rs`
running 5 tests
test test_proc_macro2_fallback_size_with_locations ... ignored
test test_proc_macro2_fallback_size_without_locations ... ignored
test test_proc_macro2_wrapper_size_with_locations ... ignored
test test_proc_macro_size ... ok
test test_proc_macro2_wrapper_size_without_locations ... FAILED
failures:
---- test_proc_macro2_wrapper_size_without_locations stdout ----
thread 'test_proc_macro2_wrapper_size_without_locations' panicked at tests/test_size.rs:52:5:
assertion `left == right` failed
  left: 20
 right: 24
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
    test_proc_macro2_wrapper_size_without_locations
test result: FAILED. 1 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 0.00s
error: test failed, to rerun pass `--test test_size`

The output points to this assertion:
https://github.com/dtolnay/proc-macro2/blob/1.0.84/tests/test_size.rs#L52

Looks like the size of proc_macro2::Group is 4 bytes smaller on i686 than on other architectures.
Possibly this affects all 32-bit architectures, but i686 is the only one that we still partially support in Fedora Linux.

As far as I can tell, the size difference is harmless (probably you just added it to make sure the size doesn't accidentally grow?), so I have ignored this test in our builds for now, but I still wanted to file an issue in case you want to add an additional not(target_pointer_width = "64") clause to the test's #[ignore] cases.

@dtolnay
Copy link
Owner

dtolnay commented Jun 2, 2024

You inferred correctly, we don't need the types to be a particular size, I just need to be cognizant of when they change size because it impacts syn's performance. And for that purpose, I personally only care about 64-bit.

Thanks for reporting the issue. I have added #[cfg_attr(not(target_pointer_width = "64"), ignore)] in proc-macro2 1.0.85.

$ cargo miri test --test test_size --target i686-unknown-linux-gnu
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.04s
     Running tests/test_size.rs (target/miri/i686-unknown-linux-gnu/debug/deps/test_size-b5488b1435a7fdbe)

running 5 tests
test test_proc_macro2_fallback_size_with_locations ... ignored
test test_proc_macro2_fallback_size_without_locations ... ignored
test test_proc_macro2_wrapper_size_with_locations ... ignored
test test_proc_macro2_wrapper_size_without_locations ... ignored
test test_proc_macro_size ... ignored

test result: ok. 0 passed; 0 failed; 5 ignored; 0 measured; 0 filtered out; finished in 0.35s

@decathorpe
Copy link
Author

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants