mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Add must_use
to IntoRawFd/IntoRawSocket/IntoRawHandle's methods.
This commit is contained in:
parent
0d49862998
commit
6d477d3a9d
@ -138,6 +138,7 @@ pub trait IntoRawFd {
|
||||
/// let raw_fd: RawFd = f.into_raw_fd();
|
||||
/// # Ok::<(), io::Error>(())
|
||||
/// ```
|
||||
#[must_use = "losing the raw file descriptor may leak resources"]
|
||||
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
||||
fn into_raw_fd(self) -> RawFd;
|
||||
}
|
||||
|
@ -347,6 +347,7 @@ pub trait IntoRawFd {
|
||||
/// This function **transfers ownership** of the underlying file descriptor
|
||||
/// to the caller. Callers are then the unique owners of the file descriptor
|
||||
/// and must close the descriptor once it's no longer needed.
|
||||
#[must_use = "losing the raw file descriptor may leak resources"]
|
||||
fn into_raw_fd(self) -> RawFd;
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,7 @@ pub trait IntoRawHandle {
|
||||
/// However, transferring ownership is not strictly required. Use a
|
||||
/// `Into<OwnedHandle>::into` implementation for an API which strictly
|
||||
/// transfers ownership.
|
||||
#[must_use = "losing the raw handle may leak resources"]
|
||||
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
||||
fn into_raw_handle(self) -> RawHandle;
|
||||
}
|
||||
@ -230,6 +231,7 @@ pub trait IntoRawSocket {
|
||||
/// However, transferring ownership is not strictly required. Use a
|
||||
/// `Into<OwnedSocket>::into` implementation for an API which strictly
|
||||
/// transfers ownership.
|
||||
#[must_use = "losing the raw socket may leak resources"]
|
||||
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
||||
fn into_raw_socket(self) -> RawSocket;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user