From 2bb7fdb8e16788367ea4a3403ac405b8bc614cc6 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 10 May 2022 21:42:30 -0700 Subject: [PATCH] Also document that `as_raw_handle` may return NULL. --- library/std/src/os/windows/io/raw.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/std/src/os/windows/io/raw.rs b/library/std/src/os/windows/io/raw.rs index 68fa8918a56a..49e4f304f5db 100644 --- a/library/std/src/os/windows/io/raw.rs +++ b/library/std/src/os/windows/io/raw.rs @@ -32,8 +32,15 @@ pub trait AsRawHandle { /// raw handle to the caller, and the handle is only guaranteed /// to be valid while the original object has not yet been destroyed. /// + /// This function may return null, such as when called on [`Stdin`], + /// [`Stdout`], or [`Stderr`] when the console is detached. + /// /// However, borrowing is not strictly required. See [`AsHandle::as_handle`] /// for an API which strictly borrows a handle. + /// + /// [`Stdin`]: io::Stdin + /// [`Stdout`]: io::Stdout + /// [`Stderr`]: io::Stderr #[stable(feature = "rust1", since = "1.0.0")] fn as_raw_handle(&self) -> RawHandle; }