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

Fix unsoundness issues #106 and #107 #109

Merged
merged 8 commits into from
Oct 1, 2024

Conversation

aumetra
Copy link
Contributor

@aumetra aumetra commented Jun 26, 2024

This PR fixes the unsoundness reported in #106 and #107

cc @steffahn (for checking the fixes, whether they are actually correct)

Closes #106
Closes #107

@aumetra
Copy link
Contributor Author

aumetra commented Jun 27, 2024

The CI failures seem unrelated. Probably UI updates in the Rust compiler.
Should I fix them in this PR or separately?

@taiki-e
Copy link
Member

taiki-e commented Sep 16, 2024

Thanks for the PR!

  • CI failure has been fixed in Fix CI failures #111.
  • Could you add regression tests for these unsoundness? (e.g., ui test to make sure that problematic cases are no longer compiled)

@aumetra
Copy link
Contributor Author

aumetra commented Sep 29, 2024

Of course, will do

Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM aside from a few nits.

async-stream-impl/src/lib.rs Outdated Show resolved Hide resolved
async-stream-impl/src/lib.rs Outdated Show resolved Hide resolved
async-stream/tests/ui/unsoundness_issue_106.rs Outdated Show resolved Hide resolved
@aumetra aumetra requested a review from taiki-e October 1, 2024 16:39
@taiki-e
Copy link
Member

taiki-e commented Oct 1, 2024

It seems that the MSRV bump triggered a new clippy warning. Could you address that as well?

error: initializer for `thread_local` value can be made `const`
  --> async-stream/src/yielder.rs:37:45
   |
37 | thread_local!(static STORE: Cell<*mut ()> = Cell::new(ptr::null_mut()));
   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { Cell::new(ptr::null_mut()) }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_thread_local
   = note: `-D clippy::missing-const-for-thread-local` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::missing_const_for_thread_local)]`

@aumetra
Copy link
Contributor Author

aumetra commented Oct 1, 2024

I mean, I just allowed the clippy lint for now since the MSRV definitely doesn't have support for inline const

@taiki-e
Copy link
Member

taiki-e commented Oct 1, 2024

inline const in thread_local is special and is available since Rust 1.59: rust-lang/rust#91355

@aumetra
Copy link
Contributor Author

aumetra commented Oct 1, 2024

Ah, interesting. Didn't know. Fixing it.

@taiki-e taiki-e merged commit 97d1d3e into tokio-rs:master Oct 1, 2024
5 checks passed
@aumetra aumetra deleted the fix-unsoundness branch October 1, 2024 19:12
@taiki-e taiki-e mentioned this pull request Oct 1, 2024
@taiki-e
Copy link
Member

taiki-e commented Oct 1, 2024

Published in 0.3.6.

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