rust/library/std/src/os/fd
Matthias Krüger 1f700139f8
Rollup merge of #127586 - zachs18:more-must-use, r=cuviper
Add `#[must_use]` to some `into_raw*` functions.

cc #121287

r? ``@cuviper``

Adds `#[must_use = "losing the pointer will leak memory"]`[^1] to `Box::into_raw(_with_allocator)`, `Vec::into_raw_parts(_with_alloc)`, `String::into_raw_parts`[^2], and `rc::{Rc, Weak}::into_raw_with_allocator` (Rc's normal `into_raw` and all of `Arc`'s `into_raw*`s are already `must_use`).

Adds `#[must_use = "losing the raw <resource name may leak resources"]` to `IntoRawFd::into_raw_fd`, `IntoRawSocket::into_raw_socket`, and `IntoRawHandle::into_raw_handle`.

[^1]: "*will* leak memory" may be too-strong wording (since `Box`/`Vec`/`String`/`rc::Weak` might not have a backing allocation), but I left it as-is for simplicity and consistency.

[^2]: `String::into_raw_parts`'s `must_use` message is changed from the previous (possibly misleading) "`self` will be dropped if the result is not used".
2024-08-03 11:17:42 +02:00
..
mod.rs Fix the stability attributes for std::os::fd. 2023-01-14 09:47:34 -08:00
net.rs Factor out a common RawFd/AsRawFd/etc for Unix and WASI. 2021-08-19 13:27:19 -07:00
owned.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
raw.rs Rollup merge of #127586 - zachs18:more-must-use, r=cuviper 2024-08-03 11:17:42 +02:00
tests.rs Add rustc_nonnull_optimization_guaranteed to Owned/Borrowed Fd/Socket 2022-05-11 07:26:49 -07:00