Skip to content

Commit 7d81d10

Browse files
committed
align.bytes_usize() instead of align.bytes().try_into().unwrap()
1 parent 2f1c251 commit 7d81d10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/alloc_bytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl AllocBytes for MiriAllocBytes {
8484
fn from_bytes<'a>(slice: impl Into<Cow<'a, [u8]>>, align: Align) -> Self {
8585
let slice = slice.into();
8686
let size = slice.len();
87-
let align = align.bytes().try_into().unwrap();
87+
let align = align.bytes_usize();
8888
// SAFETY: `alloc_fn` will only be used if `size != 0`.
8989
let alloc_fn = |layout| unsafe { alloc::alloc(layout) };
9090
let alloc_bytes = MiriAllocBytes::alloc_with(size, align, alloc_fn)
@@ -97,7 +97,7 @@ impl AllocBytes for MiriAllocBytes {
9797

9898
fn zeroed(size: Size, align: Align) -> Option<Self> {
9999
let size = size.bytes_usize();
100-
let align = align.bytes().try_into().unwrap();
100+
let align = align.bytes_usize();
101101
// SAFETY: `alloc_fn` will only be used if `size != 0`.
102102
let alloc_fn = |layout| unsafe { alloc::alloc_zeroed(layout) };
103103
MiriAllocBytes::alloc_with(size, align, alloc_fn).ok()

0 commit comments

Comments
 (0)