File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
library/std/src/os/windows/io Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,13 @@ pub struct BorrowedHandle<'handle> {
47
47
/// `INVALID_HANDLE_VALUE` instead of null, use [`OptionFileHandle`] instead
48
48
/// of `Option<OwnedHandle>`.
49
49
///
50
+ /// `OwnedHandle` uses [`CloseHandle`] to close its handle on drop. As such,
51
+ /// it must not be used with handles to open registry keys which need to be
52
+ /// closed with [`RegCloseKey`] instead.
53
+ ///
54
+ /// [`CloseHandle`]: https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle
55
+ /// [`RegCloseKey`]: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regclosekey
56
+ ///
50
57
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
51
58
#[ repr( transparent) ]
52
59
#[ unstable( feature = "io_safety" , issue = "87074" ) ]
@@ -178,8 +185,14 @@ impl FromRawHandle for OwnedHandle {
178
185
///
179
186
/// # Safety
180
187
///
181
- /// The resource pointed to by `raw` must be open and suitable for assuming
182
- /// ownership. The resource must not require any cleanup other than `CloseHandle`.
188
+ /// The resource pointed to by `raw` must be open and suitable for
189
+ /// assuming ownership. The resource must not require any cleanup other
190
+ /// than `CloseHandle`.
191
+ ///
192
+ /// In particular, it must not be used with handles to open registry
193
+ /// keys which need to be closed with [`RegCloseKey`] instead.
194
+ ///
195
+ /// [`RegCloseKey`]: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regclosekey
183
196
#[ inline]
184
197
unsafe fn from_raw_handle ( raw : RawHandle ) -> Self {
185
198
assert ! ( !raw. is_null( ) ) ;
You can’t perform that action at this time.
0 commit comments