diff --git a/std/src/sys/pal/windows/compat.rs b/std/src/sys/pal/windows/compat.rs index 190e6ba0cf24f..49fa1603f3e1e 100644 --- a/std/src/sys/pal/windows/compat.rs +++ b/std/src/sys/pal/windows/compat.rs @@ -111,8 +111,8 @@ impl Module { /// This should only be use for modules that exist for the lifetime of std /// (e.g. kernel32 and ntdll). pub unsafe fn new(name: &CStr) -> Option { + // SAFETY: A CStr is always null terminated. unsafe { - // SAFETY: A CStr is always null terminated. let module = c::GetModuleHandleA(name.as_ptr().cast::()); NonNull::new(module).map(Self) }