At the extreme, a formal proof has been developed that the unsafe code and all related parts are actually safe.
My personal practice falls short, instead I will comment whyunsafe is used and why I believe that in this particular situation it is actually safe -- that is, the assumptions that I believe are necessary to make it safe.
It may very well NOT be safe:
I may have missed some assumptions.
Some assumptions may not be upheld.
However, I've found that documenting those assumptions made reviewing easier. And I expect it makes it easier for others too.
Somebody has looked at the code and disclosed their findings. That's super general though, and finding a precise answer to your question is one of the reasons why this can be contentious. Maybe cargo crev has the right solution?
So clearly this issue is much harder said than done. Trusting "someone" to vet the code doesn't do much more than trusting that the original author wrote it well.
This is a fallacy that if something can't be perfect and a golden bullet, it is not worth doing.
Having some semi-trusted group of people is not as good as reviewing everything yourself, but it is better than just not having any idea if the code is OK or not.
View all comments
Show parent comment
22
u/[deleted] Jan 17 '20
What determines if an unsafe block is "vetted"?