Mercurial > crates > nonstick
diff src/libpam/memory.rs @ 105:13b4d2a19674
Support Rust v1.75.0.
This is the version included in Ubuntu 24.04 LTS and Debian Trixie,
so it's old enough to have wide penetration without being too old
to get new features (Debian Stable, I love you but v1.63 is just
not going to work out).
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Thu, 26 Jun 2025 00:48:51 -0400 |
parents | 3f11b8d30f63 |
children | 49d9e2b5c189 |
line wrap: on
line diff
--- a/src/libpam/memory.rs Wed Jun 25 16:56:56 2025 -0400 +++ b/src/libpam/memory.rs Thu Jun 26 00:48:51 2025 -0400 @@ -6,11 +6,12 @@ use std::ffi::{c_char, CStr, CString}; use std::fmt::{Display, Formatter, Result as FmtResult}; use std::marker::{PhantomData, PhantomPinned}; -use std::mem::{offset_of, ManuallyDrop}; +use std::mem::{ManuallyDrop}; use std::ops::{Deref, DerefMut}; use std::ptr::NonNull; use std::result::Result as StdResult; use std::{mem, ptr, slice}; +use memoffset::offset_of; /// Raised from `calloc` when you have no memory! #[derive(Debug)] @@ -34,7 +35,7 @@ #[inline] pub fn calloc<T>(count: usize) -> StdResult<NonNull<T>, NoMem> { // SAFETY: it's always safe to allocate! Leaking memory is fun! - NonNull::new(unsafe { libc::calloc(count, size_of::<T>()) }.cast()).ok_or(NoMem) + NonNull::new(unsafe { libc::calloc(count, mem::size_of::<T>()) }.cast()).ok_or(NoMem) } /// Wrapper for [`libc::free`] to make debugging calls/frees easier.