@@ -15,7 +15,7 @@ pub unsafe trait Context : private::Sealed {
15
15
/// A constant description of the context.
16
16
const DESCRIPTION : & ' static str ;
17
17
/// A function to deallocate the memory when the context is dropped.
18
- fn deallocate ( ptr : * mut [ u8 ] ) ;
18
+ unsafe fn deallocate ( ptr : * mut [ u8 ] ) ;
19
19
}
20
20
21
21
/// Marker trait for indicating that an instance of `Secp256k1` can be used for signing.
@@ -78,26 +78,26 @@ mod std_only {
78
78
const FLAGS : c_uint = ffi:: SECP256K1_START_SIGN ;
79
79
const DESCRIPTION : & ' static str = "signing only" ;
80
80
81
- fn deallocate ( ptr : * mut [ u8 ] ) {
82
- let _ = unsafe { Box :: from_raw ( ptr) } ;
81
+ unsafe fn deallocate ( ptr : * mut [ u8 ] ) {
82
+ let _ = Box :: from_raw ( ptr) ;
83
83
}
84
84
}
85
85
86
86
unsafe impl Context for VerifyOnly {
87
87
const FLAGS : c_uint = ffi:: SECP256K1_START_VERIFY ;
88
88
const DESCRIPTION : & ' static str = "verification only" ;
89
89
90
- fn deallocate ( ptr : * mut [ u8 ] ) {
91
- let _ = unsafe { Box :: from_raw ( ptr) } ;
90
+ unsafe fn deallocate ( ptr : * mut [ u8 ] ) {
91
+ let _ = Box :: from_raw ( ptr) ;
92
92
}
93
93
}
94
94
95
95
unsafe impl Context for All {
96
96
const FLAGS : c_uint = VerifyOnly :: FLAGS | SignOnly :: FLAGS ;
97
97
const DESCRIPTION : & ' static str = "all capabilities" ;
98
98
99
- fn deallocate ( ptr : * mut [ u8 ] ) {
100
- let _ = unsafe { Box :: from_raw ( ptr) } ;
99
+ unsafe fn deallocate ( ptr : * mut [ u8 ] ) {
100
+ let _ = Box :: from_raw ( ptr) ;
101
101
}
102
102
}
103
103
@@ -152,7 +152,6 @@ mod std_only {
152
152
}
153
153
}
154
154
}
155
-
156
155
}
157
156
158
157
impl < ' buf > Signing for SignOnlyPreallocated < ' buf > { }
@@ -165,7 +164,7 @@ unsafe impl<'buf> Context for SignOnlyPreallocated<'buf> {
165
164
const FLAGS : c_uint = ffi:: SECP256K1_START_SIGN ;
166
165
const DESCRIPTION : & ' static str = "signing only" ;
167
166
168
- fn deallocate ( _ptr : * mut [ u8 ] ) {
167
+ unsafe fn deallocate ( _ptr : * mut [ u8 ] ) {
169
168
// Allocated by the user
170
169
}
171
170
}
@@ -174,7 +173,7 @@ unsafe impl<'buf> Context for VerifyOnlyPreallocated<'buf> {
174
173
const FLAGS : c_uint = ffi:: SECP256K1_START_VERIFY ;
175
174
const DESCRIPTION : & ' static str = "verification only" ;
176
175
177
- fn deallocate ( _ptr : * mut [ u8 ] ) {
176
+ unsafe fn deallocate ( _ptr : * mut [ u8 ] ) {
178
177
// Allocated by the user
179
178
}
180
179
}
@@ -183,7 +182,7 @@ unsafe impl<'buf> Context for AllPreallocated<'buf> {
183
182
const FLAGS : c_uint = SignOnlyPreallocated :: FLAGS | VerifyOnlyPreallocated :: FLAGS ;
184
183
const DESCRIPTION : & ' static str = "all capabilities" ;
185
184
186
- fn deallocate ( _ptr : * mut [ u8 ] ) {
185
+ unsafe fn deallocate ( _ptr : * mut [ u8 ] ) {
187
186
// Allocated by the user
188
187
}
189
188
}
0 commit comments