Skip to content

Commit 6d74730

Browse files
committed
secp256k1: Document safety constraints
Add a `# Safety` section to all unsafe traits, methods, and functions. Remove the clippy attribute for `missing_safety_doc`.
1 parent 85681ce commit 6d74730

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/context.rs

+8
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,20 @@ pub mod global {
6262

6363
/// A trait for all kinds of contexts that lets you define the exact flags and a function to
6464
/// deallocate memory. It isn't possible to implement this for types outside this crate.
65+
///
66+
/// # Safety
67+
///
68+
/// This trait is marked unsafe to allow unsafe implementations of `deallocate`.
6569
pub unsafe trait Context: private::Sealed {
6670
/// Flags for the ffi.
6771
const FLAGS: c_uint;
6872
/// A constant description of the context.
6973
const DESCRIPTION: &'static str;
7074
/// A function to deallocate the memory when the context is dropped.
75+
///
76+
/// # Safety
77+
///
78+
/// `ptr` must be valid. Further safety constraints may be imposed by [`std::alloc::dealloc`].
7179
unsafe fn deallocate(ptr: *mut u8, size: usize);
7280
}
7381

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@
152152
// Coding conventions
153153
#![deny(non_upper_case_globals, non_camel_case_types, non_snake_case)]
154154
#![warn(missing_docs, missing_copy_implementations, missing_debug_implementations)]
155-
#![allow(clippy::missing_safety_doc)]
156155
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
157156
// Experimental features we need.
158157
#![cfg_attr(docsrs, feature(doc_cfg))]

0 commit comments

Comments
 (0)