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

Sahid Orentino Ferdjaoui sahid.ferdjaoui at canonical.com
Wed Oct 16 11:06:57 UTC 2019


On Mon, Sep 30, 2019 at 12:10:49PM +0200, Martin Kletzander wrote:
> 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.

Yes I'm agree, they should just not be public.

s.




More information about the libvir-list mailing list