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

chore: prefer usize::MAX to std::usize::MAX #157

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

tisonkun
Copy link
Contributor

@tisonkun tisonkun commented Oct 4, 2023

Per #140 (comment)

Hopefully, we can move Events free. Open for comments :D

src/lib.rs Outdated
Comment on lines 138 to 139
unsafe impl Send for Event {}
unsafe impl Sync for Event {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the additional unsafe here. Can we just add a test to make sure the Event struct is Send and Sync?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a test

Do you mean that we ensure the auto trait happens by testing? What's the difference to this patch that let the compiler do the "test"?

These two lines are automatically done if it meets the auto trait conditions. We declare them explicitly for testing here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'm pushing a commit now - this seems a style preference :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have it in _assert_send_and_sync.

Then I'll convert this patch as a trivial code tidy one.

Signed-off-by: tison <[email protected]>
@tisonkun tisonkun changed the title feat: ensure impl Send and Sync for Event chore: prefer usize::MAX to std::usize::MAX Oct 6, 2023
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@notgull notgull merged commit ceb88a4 into smol-rs:master Oct 6, 2023
24 checks passed
@tisonkun tisonkun deleted the impl-send-sync-for-event branch October 6, 2023 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants