File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use safety::requires;
66#[ cfg( kani) ]
77#[ unstable( feature="kani" , issue="none" ) ]
88use core:: kani;
9+ use core:: ub_checks;
910
1011use core:: error:: Error ;
1112use core:: fmt:: { self , Debug , Display , Formatter } ;
@@ -366,9 +367,10 @@ impl<H> WithHeader<H> {
366367 }
367368
368369 // Safety:
369- #[ requires( value. is_null( ) || value. is_aligned( ) ) ]
370370 // - Assumes that either `value` can be dereferenced, or is the
371371 // `NonNull::dangling()` we use when both `T` and `H` are ZSTs.
372+ #[ requires( ( mem:: size_of_val_raw( value) == 0 && size_of:: <H >( ) == 0 ) ||
373+ ub_checks:: can_dereference( value) ) ]
372374 unsafe fn drop < T : ?Sized > ( & self , value : * mut T ) {
373375 struct DropGuard < H > {
374376 ptr : NonNull < u8 > ,
Original file line number Diff line number Diff line change 9292// Library features:
9393// tidy-alphabetical-start
9494#![ cfg_attr( kani, feature( kani) ) ]
95+ #![ cfg_attr( kani, feature( ub_checks) ) ]
9596#![ cfg_attr( not( no_global_oom_handling) , feature( const_alloc_error) ) ]
9697#![ cfg_attr( not( no_global_oom_handling) , feature( const_btree_len) ) ]
9798#![ feature( alloc_layout_extra) ]
You can’t perform that action at this time.
0 commit comments