File tree 3 files changed +8
-0
lines changed
3 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 3
3
" crev" ,
4
4
" dealloc" ,
5
5
" docsrs" ,
6
+ " miri" ,
6
7
" powerset" ,
7
8
" repr" ,
8
9
" Unsafety"
Original file line number Diff line number Diff line change @@ -261,7 +261,13 @@ impl<A: Alignment> Default for AlignedBytes<A> {
261
261
// but for `A::size()` alignment.
262
262
// The only requirement of new_unchecked is the pointer being not-null, and A::size() must be > 0.
263
263
let bytes_ptr = unsafe {
264
+ // Use strict pointer functions if enabled.
265
+ // See https://github.com/V0ldek/aligners/issues/34
266
+ #[ cfg( miri) ]
267
+ let raw_ptr = std:: ptr:: invalid_mut ( A :: size ( ) ) ;
268
+ #[ cfg( not( miri) ) ]
264
269
let raw_ptr = A :: size ( ) as * mut u8 ;
270
+
265
271
NonNull :: new_unchecked ( raw_ptr)
266
272
} ;
267
273
Self {
Original file line number Diff line number Diff line change 25
25
// Same goes for the revolutionary "link to pointers documentation" feature.
26
26
// (https://github.com/rust-lang/rust/issues/80896).
27
27
#![ cfg_attr( docsrs, feature( intra_doc_pointers) ) ]
28
+ #![ cfg_attr( miri, feature( strict_provenance) ) ]
28
29
29
30
//! Structures providing guarantees on byte sequence alignment.
30
31
//!
You can’t perform that action at this time.
0 commit comments