rust-random / getrandom

A small cross-platform library for retrieving random data from (operating) system source
Apache License 2.0
275 stars 180 forks source link

Document the safety assumptions in use of `Weak` #429

Closed briansmith closed 4 months ago

briansmith commented 4 months ago

Make the conversion from NonNull<c_void> to a function pointer more explicit and document the safety assumptions.

josephlr commented 4 months ago

I don't think it's possible to cast to a function pointer without transmute, here are the docs: https://doc.rust-lang.org/std/primitive.fn.html#casting-to-and-from-integers

briansmith commented 4 months ago

Just to reiterate: It is concerning that we only use Weak on a platform for which we don't run tests in CI.

newpavlov commented 4 months ago

Yes, right now we have built-only CI jobs for many targets. We probably will need to use VMs for targets like NetBSD (I don't think self-hosted runners will be a practical option for us). Looking into https://github.com/vmactions can be a good starting point. It's probably better to discuss it in a separate issue.

newpavlov commented 4 months ago

@briansmith Could you please rebase or open a new PR with this change?

briansmith commented 4 months ago

Yes, I will revisit this when we have a testing solution for it.