diff --git a/common/src/fileutils.rs b/common/src/fileutils.rs index 104c6bcd28..dcb78675d8 100644 --- a/common/src/fileutils.rs +++ b/common/src/fileutils.rs @@ -327,7 +327,17 @@ pub mod windows { if let Some(proc) = unsafe { GetProcAddress(module, name.as_bytes_with_nul().as_ptr()) } { - Some(unsafe { std::mem::transmute(proc) }) + Some(unsafe { + std::mem::transmute::< + unsafe extern "system" fn() -> isize, + unsafe extern "system" fn( + *const u16, + FILE_INFO_BY_NAME_CLASS, + *mut libc::c_void, + u32, + ) -> i32, + >(proc) + }) } else { unsafe { FreeLibrary(module) }; None diff --git a/stdlib/src/ssl.rs b/stdlib/src/ssl.rs index 51b22e3666..f4bd9b2ebb 100644 --- a/stdlib/src/ssl.rs +++ b/stdlib/src/ssl.rs @@ -379,7 +379,7 @@ mod _ssl { #[pyfunction(name = "RAND_add")] fn rand_add(string: ArgStrOrBytesLike, entropy: f64) { let f = |b: &[u8]| { - for buf in b.chunks(libc::c_int::max_value() as usize) { + for buf in b.chunks(libc::c_int::MAX as usize) { unsafe { sys::RAND_add(buf.as_ptr() as *const _, buf.len() as _, entropy) } } }; @@ -1513,7 +1513,7 @@ mod bio { pub fn new(buf: &'a [u8]) -> Result, ErrorStack> { openssl::init(); - assert!(buf.len() <= c_int::max_value() as usize); + assert!(buf.len() <= c_int::MAX as usize); let bio = unsafe { sys::BIO_new_mem_buf(buf.as_ptr() as *const _, buf.len() as c_int) }; if bio.is_null() { return Err(ErrorStack::get()); diff --git a/vm/src/function/method.rs b/vm/src/function/method.rs index 82479dbde8..efb0b7a5f3 100644 --- a/vm/src/function/method.rs +++ b/vm/src/function/method.rs @@ -236,7 +236,9 @@ impl std::fmt::Debug for PyMethodDef { .field("name", &self.name) .field( "func", - &(unsafe { std::mem::transmute::<_, [usize; 2]>(self.func)[1] as *const u8 }), + &(unsafe { + std::mem::transmute::<&dyn PyNativeFn, [usize; 2]>(self.func)[1] as *const u8 + }), ) .field("flags", &self.flags) .field("doc", &self.doc) diff --git a/vm/src/intern.rs b/vm/src/intern.rs index b6197d61f7..1f6fb09f28 100644 --- a/vm/src/intern.rs +++ b/vm/src/intern.rs @@ -286,7 +286,7 @@ impl MaybeInternedString for Py { #[inline(always)] fn as_interned(&self) -> Option<&'static PyStrInterned> { if self.as_object().is_interned() { - Some(unsafe { std::mem::transmute(self) }) + Some(unsafe { std::mem::transmute::<&Py, &PyInterned>(self) }) } else { None } diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index 4375d972e2..a5acd49ca9 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -999,7 +999,7 @@ pub(super) mod _os { -1 } else { distance_to_move[0] = ret as _; - std::mem::transmute(distance_to_move) + std::mem::transmute::<[i32; 2], i64>(distance_to_move) } }; if res < 0 {