Forbid unsafe_op_in_unsafe_fn in sys/pal/windows · model-checking/verify-rust-std@8456a97 (original) (raw)

Original file line number Diff line number Diff line change
@@ -134,26 +134,26 @@ compat_fn_with_fallback! {
134 134 // >= Win10 1607
135 135 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription
136 136 pub fn SetThreadDescription(hthread: HANDLE, lpthreaddescription: PCWSTR) -> HRESULT {
137 -SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL
137 +unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL }
138 138 }
139 139
140 140 // >= Win10 1607
141 141 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreaddescription
142 142 pub fn GetThreadDescription(hthread: HANDLE, lpthreaddescription: *mut PWSTR) -> HRESULT {
143 -SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL
143 +unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL }
144 144 }
145 145
146 146 // >= Win8 / Server 2012
147 147 // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
148 148 #[cfg(target_vendor = "win7")]
149 149 pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () {
150 -GetSystemTimeAsFileTime(lpsystemtimeasfiletime)
150 +unsafe { GetSystemTimeAsFileTime(lpsystemtimeasfiletime) }
151 151 }
152 152
153 153 // >= Win11 / Server 2022
154 154 // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2a
155 155 pub fn GetTempPath2W(bufferlength: u32, buffer: PWSTR) -> u32 {
156 -GetTempPathW(bufferlength, buffer)
156 +unsafe { GetTempPathW(bufferlength, buffer) }
157 157 }
158 158 }
159 159