mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-01 20:47:36 +00:00
![]() Lint pinned `#[must_use]` pointers (in particular, `Box<T>` where `T` is `#[must_use]`) in `unused_must_use`. Fixes: #111458 This is motivated by a common async/await pattern: ```rs fn foo() -> Pin<Box<dyn Future<Output = i32>>> { Box::pin(async { 42 }) } // call `foo`, but forget to await the result foo(); ``` Unlike with `async fn` or return position `impl Future`, this does not currently warn the user that the `Future` is unused. To fix this, I've extended the `unused_must_use` lint to catch `Pin<P>`, where `P` must be used. In particular, this applies to `Pin<Box<T>>`, where `T` must be used. I'm not sure if there are other pointers where this applies, but I can't think of any situation the user wouldn't want to be warned. |
||
---|---|---|
.. | ||
assembly | ||
auxiliary | ||
codegen | ||
codegen-units | ||
coverage | ||
coverage-run-rustdoc | ||
debuginfo | ||
incremental | ||
mir-opt | ||
pretty | ||
run-make | ||
run-make-fulldeps | ||
run-pass-valgrind | ||
rustdoc | ||
rustdoc-gui | ||
rustdoc-js | ||
rustdoc-js-std | ||
rustdoc-json | ||
rustdoc-ui | ||
ui | ||
ui-fulldeps | ||
COMPILER_TESTS.md |