rust/library/alloc/src
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
..
alloc Reformat use declarations. 2024-07-29 08:26:52 +10:00
boxed Reformat use declarations. 2024-07-29 08:26:52 +10:00
collections Rollup merge of #128310 - kmicklas:btree-map-peek-next-docs, r=tgross35 2024-07-29 07:11:16 +02:00
ffi Reformat use declarations. 2024-07-29 08:26:52 +10:00
raw_vec Reformat use declarations. 2024-07-29 08:26:52 +10:00
rc Reformat use declarations. 2024-07-29 08:26:52 +10:00
slice Reformat use declarations. 2024-07-29 08:26:52 +10:00
sync Reformat use declarations. 2024-07-29 08:26:52 +10:00
testing Reformat use declarations. 2024-07-29 08:26:52 +10:00
vec Rollup merge of #127586 - zachs18:more-must-use, r=cuviper 2024-08-03 11:17:42 +02:00
alloc.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
borrow.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
boxed.rs Rollup merge of #127586 - zachs18:more-must-use, r=cuviper 2024-08-03 11:17:42 +02:00
fmt.rs Fix doc nits 2024-07-26 13:26:33 +01:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68 2024-07-30 17:49:08 +00:00
macros.rs Mark format! with must_use hint 2024-07-06 14:24:20 +02:00
raw_vec.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
rc.rs Rollup merge of #127586 - zachs18:more-must-use, r=cuviper 2024-08-03 11:17:42 +02:00
slice.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
str.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
string.rs Rollup merge of #127586 - zachs18:more-must-use, r=cuviper 2024-08-03 11:17:42 +02:00
sync.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
task.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
tests.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00