mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
![]() Add #[must_use] to alloc functions that would leak memory As [requested](https://github.com/rust-lang/rust/pull/89899#issuecomment-955600779) by `@joshtriplett.` > Please do go ahead and add the ones whose only legitimate use for ignoring the return value is leaking memory. (In a separate PR please.) I think it's sufficiently error-prone to call something like alloc and ignore the result that it's legitimate to require `let _ =` for that. I added `realloc` myself. Clippy ignored it because of its `mut` argument. ```rust alloc/src/alloc.rs:123:1 alloc unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8; ``` Parent issue: #89692 r? `@joshtriplett` |
||
---|---|---|
.. | ||
alloc | ||
backtrace@7f14f76c8b | ||
core | ||
panic_abort | ||
panic_unwind | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@5fdbc476af | ||
test | ||
unwind |