diff --git a/src/core/alloc/je.rs b/src/core/alloc/je.rs index 4092d815..ebf3575f 100644 --- a/src/core/alloc/je.rs +++ b/src/core/alloc/je.rs @@ -30,7 +30,10 @@ pub fn memory_stats() -> String { let mut str = String::new(); let opaque = std::ptr::from_mut(&mut str).cast::(); - let opts_p: *const c_char = std::ffi::CString::new(opts_s).expect("cstring").into_raw() as *const c_char; + let opts_p: *const c_char = std::ffi::CString::new(opts_s) + .expect("cstring") + .into_raw() + .cast_const(); // SAFETY: calls malloc_stats_print() with our string instance which must remain // in this frame. https://docs.rs/tikv-jemalloc-sys/latest/tikv_jemalloc_sys/fn.malloc_stats_print.html diff --git a/src/router/run.rs b/src/router/run.rs index d20f8669..e6238853 100644 --- a/src/router/run.rs +++ b/src/router/run.rs @@ -97,7 +97,7 @@ pub(crate) async fn stop(_server: Arc) -> Result<(), Error> { .take() .unwrap(); - let s = std::ptr::from_ref(s) as *mut Services; + let s: *mut Services = std::ptr::from_ref(s).cast_mut(); //SAFETY: Services was instantiated in start() and leaked into the SERVICES // global perusing as 'static for the duration of run_server(). Now we reclaim // it to drop it before unloading the module. If this is not done there will be