File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -270,12 +270,20 @@ unsafe impl Encode for *const c_void {
270
270
const ENCODING : Encoding < ' static > = Encoding :: Pointer ( & Encoding :: Void ) ;
271
271
}
272
272
273
+ unsafe impl RefEncode for * const c_void {
274
+ const ENCODING_REF : Encoding < ' static > = Encoding :: Pointer ( & Self :: ENCODING ) ;
275
+ }
276
+
273
277
/// [`Encode`] is implemented manually for `*mut c_void`, instead of
274
278
/// implementing [`RefEncode`], to discourage creating `&mut c_void`.
275
279
unsafe impl Encode for * mut c_void {
276
280
const ENCODING : Encoding < ' static > = Encoding :: Pointer ( & Encoding :: Void ) ;
277
281
}
278
282
283
+ unsafe impl RefEncode for * mut c_void {
284
+ const ENCODING_REF : Encoding < ' static > = Encoding :: Pointer ( & Self :: ENCODING ) ;
285
+ }
286
+
279
287
unsafe impl < T : Encode , const LENGTH : usize > Encode for [ T ; LENGTH ] {
280
288
const ENCODING : Encoding < ' static > = Encoding :: Array ( LENGTH , & T :: ENCODING ) ;
281
289
}
@@ -504,6 +512,10 @@ mod tests {
504
512
<* const c_void>:: ENCODING ,
505
513
Encoding :: Pointer ( & Encoding :: Void )
506
514
) ;
515
+ assert_eq ! (
516
+ <& * const c_void>:: ENCODING ,
517
+ Encoding :: Pointer ( & Encoding :: Pointer ( & Encoding :: Void ) )
518
+ ) ;
507
519
508
520
// Shouldn't compile
509
521
// assert_eq!(<c_void>::ENCODING, Encoding::Void);
You can’t perform that action at this time.
0 commit comments