]> git.lizzy.rs Git - rust.git/commitdiff
Add a comment explaining the `(())` idiom for empty structs.
authorDan Gohman <dev@sunfishcode.online>
Wed, 13 Apr 2022 21:32:17 +0000 (14:32 -0700)
committerDan Gohman <dev@sunfishcode.online>
Mon, 18 Apr 2022 23:53:50 +0000 (16:53 -0700)
library/std/src/os/windows/io/handle.rs

index e48f630f76e7fdfdf4bdaaa20672d30f76c5edf5..e4de52612ef6232a8b0f668bb960311214d64556 100644 (file)
@@ -220,6 +220,7 @@ fn try_from(handle_or_invalid: HandleOrInvalid) -> Result<Self, InvalidHandleErr
 
 /// This is the error type used by [`HandleOrNull`] when attempting to convert
 /// into a handle, to indicate that the value is null.
+// The empty field prevents constructing this, and allows extending it in the future.
 #[unstable(feature = "io_safety", issue = "87074")]
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct NullHandleError(());
@@ -237,6 +238,7 @@ impl crate::error::Error for NullHandleError {}
 /// This is the error type used by [`HandleOrInvalid`] when attempting to
 /// convert into a handle, to indicate that the value is
 /// `INVALID_HANDLE_VALUE`.
+// The empty field prevents constructing this, and allows extending it in the future.
 #[unstable(feature = "io_safety", issue = "87074")]
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct InvalidHandleError(());