diff --git a/src/context.rs b/src/context.rs index 937ae5d..3d61fe8 100644 --- a/src/context.rs +++ b/src/context.rs @@ -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 /// 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 { /// Flags for the ffi. const FLAGS: c_uint; /// A constant description of the context. const DESCRIPTION: &'static str; /// 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); } diff --git a/src/lib.rs b/src/lib.rs index a443560..7471a18 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -152,7 +152,6 @@ // Coding conventions #![deny(non_upper_case_globals, non_camel_case_types, non_snake_case)] #![warn(missing_docs, missing_copy_implementations, missing_debug_implementations)] -#![allow(clippy::missing_safety_doc)] #![cfg_attr(all(not(test), not(feature = "std")), no_std)] // Experimental features we need. #![cfg_attr(docsrs, feature(doc_cfg))]