diff options
| author | Dan Gohman <dev@sunfishcode.online> | 2022-05-11 06:36:54 -0700 |
|---|---|---|
| committer | Dan Gohman <dev@sunfishcode.online> | 2022-05-11 06:40:52 -0700 |
| commit | 2f75b4aaa64fb8bfb9635a879c1af52a5d68f662 (patch) | |
| tree | 3dec3242abce79e3e2c3b5df666e4baa80697bff | |
| parent | 0a39e5ad36419c2b257a91705ac1337f18a5e08f (diff) | |
| download | rust-2f75b4aaa64fb8bfb9635a879c1af52a5d68f662.tar.gz rust-2f75b4aaa64fb8bfb9635a879c1af52a5d68f662.zip | |
HandleOrNull can hold null, and HandleOrInvalid can hold INVALID_HANDLE_VALUE.
| -rw-r--r-- | library/std/src/os/windows/io/handle.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/library/std/src/os/windows/io/handle.rs b/library/std/src/os/windows/io/handle.rs index ef2ef10e05f..81ae1539acb 100644 --- a/library/std/src/os/windows/io/handle.rs +++ b/library/std/src/os/windows/io/handle.rs @@ -77,9 +77,9 @@ pub struct OwnedHandle { /// `NULL`. This ensures that such FFI calls cannot start using the handle without /// checking for `NULL` first. /// -/// This type may hold any handle value that [`OwnedHandle`] may hold, except `NULL`. It may -/// hold `-1`, even though `-1` has the same value as `INVALID_HANDLE_VALUE`, because in -/// `HandleOrNull`, `-1` is interpreted to mean the current process handle. +/// This type may hold any handle value that [`OwnedHandle`] may hold. As with `OwnedHandle`, when +/// it holds `-1`, that value is interpreted as the current process handle, and not +/// `INVALID_HANDLE_VALUE`. /// /// If this holds a non-null handle, it will close the handle on drop. #[repr(transparent)] @@ -97,12 +97,8 @@ pub struct HandleOrNull(OwnedHandle); /// `INVALID_HANDLE_VALUE`. This ensures that such FFI calls cannot start using the handle without /// checking for `INVALID_HANDLE_VALUE` first. /// -/// This type may hold any handle value that [`OwnedHandle`] may hold, except `-1`. It must not -/// hold `-1`, because `-1` in `HandleOrInvalid` is interpreted to mean `INVALID_HANDLE_VALUE`. -/// -/// This type may hold `NULL`, because APIs that use `INVALID_HANDLE_VALUE` as their sentry value -/// may return `NULL` under `windows_subsystem = "windows"` or other situations where I/O devices -/// are detached. +/// This type may hold any handle value that [`OwnedHandle`] may hold, except that when it holds +/// `-1`, that value is interpreted to mean `INVALID_HANDLE_VALUE`. /// /// If holds a handle other than `INVALID_HANDLE_VALUE`, it will close the handle on drop. #[repr(transparent)] |
