let _ = ...; and
let _a = ...; seems like a common beginner mistake that leads to a buggy program instead of a compile-time error. (example mention). It is natural to think that once I bound it do something, it will live up to the end of the block and do its work.
#[must_use] does its job well for
Result-returning functions, but when the main point of return type is its Drop implementation,
#[must_use] may be not enough.
I propose an enhanced version of must_use:
Such functions or types should issue a compile-time warning not only if they are not bound to anything (
a_must_bind_fn();), but also if they are bound do
let _ = a_must_bind_fn();). This (and a helpful compiler message which would be shown on violation) would protect against situation mentioned in the linked article.
In order to really ignore
#[must_bind] and immediately drop the value,
drop(a_must_bind_fn()); should be suggested by the compiler warning message.
(This attribute name was suggested on IRC).