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

Use a wrapper type implementing Sync, instead of static mut #700

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Feb 12, 2024

static mut is generally best avoided. It seems to only be necessary currently to allow the use of non-Sync types, since pointers are not sync.

This also removes the NULLPTR constant in favor of using std::ptr::null, uses .as_ptr() instead of casting, and uses the arrray repeating syntax to define types_null. None of those should impact behavior or the public API.

*_requests and *_events static are no longer public now. This is theoretically a breaking change, but shouldn't really impact anything.

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.16%. Comparing base (eb7a57b) to head (51282ce).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #700      +/-   ##
==========================================
+ Coverage   75.34%   76.16%   +0.82%     
==========================================
  Files          48       45       -3     
  Lines        8257     8153     -104     
==========================================
- Hits         6221     6210      -11     
+ Misses       2036     1943      -93     
Flag Coverage Δ
main 59.06% <95.00%> (+0.69%) ⬆️
test-- 81.07% <100.00%> (-0.01%) ⬇️
test--server_system 64.66% <100.00%> (+0.15%) ⬆️
test-client_system- 72.18% <95.00%> (+0.03%) ⬆️
test-client_system-server_system 54.96% <95.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ids1024
Copy link
Member Author

ids1024 commented Feb 13, 2024

Re-ran CI so it would use the new nightly, and everything passes.

@elinorbgr
Copy link
Member

Could you just add a changelog entry for the scanner for this? AFAICT this is not a breaking change, but it's still noteworthy imo.

ids1024 added 2 commits March 1, 2024 11:00
`static mut` is generally best avoided. It seems to only be necessary
currently to allow the use of non-`Sync` types, since pointers are not
sync.

This also removes the `NULLPTR` constant in favor of using
`std::ptr::null`, uses `.as_ptr()` instead of casting, and uses the
arrray repeating syntax to define `types_null`. None of those should
impact behavior or the public API.

`*_requests` and `*_events` static are no longer public now. This is
theoretically a breaking change, but shouldn't really impact anything.
@ids1024 ids1024 force-pushed the no-static-mut branch 2 times, most recently from 003ac2c to ee7e346 Compare March 1, 2024 22:39
@ids1024
Copy link
Member Author

ids1024 commented Mar 1, 2024

Mentioned in changelog, and fixed more CI warnings.

@elinorbgr elinorbgr merged commit ea03873 into Smithay:master Apr 2, 2024
14 checks passed
Decodetalkers pushed a commit to Decodetalkers/wayland-rs that referenced this pull request Apr 26, 2024
…hay#700)

* Use a wrapper type implementing `Sync`, instead of `static mut`

`static mut` is generally best avoided. It seems to only be necessary
currently to allow the use of non-`Sync` types, since pointers are not
sync.

This also removes the `NULLPTR` constant in favor of using
`std::ptr::null`, uses `.as_ptr()` instead of casting, and uses the
arrray repeating syntax to define `types_null`. None of those should
impact behavior or the public API.

`*_requests` and `*_events` static are no longer public now. This is
theoretically a breaking change, but shouldn't really impact anything.

* Suppress `clippy::test_attr_in_doctest` lint

* Address nightly warnings
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 this pull request may close these issues.

2 participants