secp256k1: Document safety constraints
Add a `# Safety` section to all unsafe traits, methods, and functions. Remove the clippy attribute for `missing_safety_doc`.
This commit is contained in:
parent
85681cece7
commit
6d747301e8
|
@ -62,12 +62,20 @@ pub mod global {
|
||||||
|
|
||||||
/// A trait for all kinds of contexts that lets you define the exact flags and a function to
|
/// A trait for all kinds of contexts that lets you define the exact flags and a function to
|
||||||
/// deallocate memory. It isn't possible to implement this for types outside this crate.
|
/// deallocate memory. It isn't possible to implement this for types outside this crate.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// This trait is marked unsafe to allow unsafe implementations of `deallocate`.
|
||||||
pub unsafe trait Context: private::Sealed {
|
pub unsafe trait Context: private::Sealed {
|
||||||
/// Flags for the ffi.
|
/// Flags for the ffi.
|
||||||
const FLAGS: c_uint;
|
const FLAGS: c_uint;
|
||||||
/// A constant description of the context.
|
/// A constant description of the context.
|
||||||
const DESCRIPTION: &'static str;
|
const DESCRIPTION: &'static str;
|
||||||
/// A function to deallocate the memory when the context is dropped.
|
/// A function to deallocate the memory when the context is dropped.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// `ptr` must be valid. Further safety constraints may be imposed by [`std::alloc::dealloc`].
|
||||||
unsafe fn deallocate(ptr: *mut u8, size: usize);
|
unsafe fn deallocate(ptr: *mut u8, size: usize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,6 @@
|
||||||
// Coding conventions
|
// Coding conventions
|
||||||
#![deny(non_upper_case_globals, non_camel_case_types, non_snake_case)]
|
#![deny(non_upper_case_globals, non_camel_case_types, non_snake_case)]
|
||||||
#![warn(missing_docs, missing_copy_implementations, missing_debug_implementations)]
|
#![warn(missing_docs, missing_copy_implementations, missing_debug_implementations)]
|
||||||
#![allow(clippy::missing_safety_doc)]
|
|
||||||
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
|
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
|
||||||
// Experimental features we need.
|
// Experimental features we need.
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||||
|
|
Loading…
Reference in New Issue