[libvirt] [libvirt-rust PATCH 1/1] Make creating safe wrapper from raw pointer unsafe

Martin Kletzander mkletzan at redhat.com
Mon Sep 30 10:10:49 UTC 2019


On Wed, Sep 25, 2019 at 04:36:16PM +0000, Linus Färnstrand wrote:
>Giving an invalid pointer to the safe wrapper types causes
>undefined behavior when methods are later called on said wrapper
>
>Properly document safety contract of using unsafe constructor
>---

Ideally it should not be exposed at all because there already is a method for
getting the proper structure.  And that method (or those methods) already use ::new() so with this patch it just fails.  Tests, examples, etc.  Instead of fixing that I would, probably, just not expose them.  I don't see a reason for them being public.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190930/a7d38c0f/attachment-0001.sig>


More information about the libvir-list mailing list