Open
Description
Currently when generating virtual methods that take pointers as arguments or return pointers we label the method itself unsafe
. However generally speaking, a method that returns a pointer shouldn't cause any UB if it's called wrong. For instance Box::into_raw
is a safe method. So it's wrong (though generally harmless) for methods that only return pointers, but doesn't take them as arguments, to be labelled as unsafe
.
However when someone implements this trait, they must ensure that the pointer they return from the method satisfies certain criteria. Otherwise they may cause UB. This means that the trait the method is in must be an unsafe trait.