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(#25): Mark certain structs as !Sync #26

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

jalil-salame
Copy link
Contributor

Some objects in dlib are not Thread Safe, thus they should be marked as !Sync to do this in stable Rust, you add a field with UnsafeCell.

If you don't need UnsafeCell, then just put it inside a PhantomData, this tells the type system that your type should act as if it held an UnsafeCell, but it doesn't actually have it.

When negative_impls is stabilized, we can use that instead.

I would suggest applying this patch then bumping the crate version to 0.3.1 and yanking 0.3.0 to prevent people from downloading the previous version.

Closes #25

Some objects in dlib are not Thread Safe, thus they should be marked as !Sync
to do this in stable Rust, you add a field with `UnsafeCell`.

If you don't need `UnsafeCell`, then just put it inside a `PhantomData`, this
tells the type system that your type should act as if it held an `UnsafeCell`,
but it doesn't actually have it.

When [`negative_impls`](rust-lang/rust#68318) is
stabilized, we can use that instead.

I would suggest applying this patch then bumping the crate version to 0.3.1
and yanking 0.3.0 to prevent people from downloading the previous version.
@HoKim98
Copy link
Member

HoKim98 commented Aug 31, 2023

Confirmed as your issue #25 (comment)!

Thanks :)

@HoKim98 HoKim98 merged commit 3d927bb into ulagbulag:master Aug 31, 2023
@jalil-salame jalil-salame deleted the fix-soundness branch August 31, 2023 08:06
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.

dlib is not thread safe
2 participants