unsafe attribute and api.rs #129
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Clippy gives teh
not_unsafe_ptr_arg_deref
lint warning if a function dereferences a raw pointer but is not labelled asunsafe
. We used to suppress this warning was because labelling a functionunsafe
automatically grants it rights to use any unsafe operation inside the function. I deemed that a greater danger because we then won't be able to identify real unsafe sections within anunsafe
function.We now set
#![warn(unsafe_op_in_unsafe_fn)]
for the whole lib. It makes it necessary to use theunsafe { ... }
block even withinunsafe
functions. We now explicitly label functions asunsafe
if they deference raw pointers. But we set#![allow(clippy::missing_safety_doc)]
on theapi.rs
module because the reason for functions to be unsafe in that module is clearly because they are used by C with raw pointers.