]> git.lizzy.rs Git - rust.git/commit
`#[must_use]` for associated functions is supposed to actually work
authorZack M. Davis <code@zackmdavis.net>
Fri, 12 Oct 2018 06:10:37 +0000 (23:10 -0700)
committerZack M. Davis <code@zackmdavis.net>
Sat, 13 Oct 2018 05:01:43 +0000 (22:01 -0700)
commitab91a6b4df04a60cf19682b1f016848d3e4784ad
tree10fd45f1eaf3b09a4b84b5f1c8154e46d2334042
parentc47785f6beb7f2047b2915c42d1d3d4c0ab0abf0
`#[must_use]` for associated functions is supposed to actually work

In the comments of (closed, defunct) pull request #54884, Mazdak
"Centril" Farrokhzad noted that must-use annotations didn't work on an
associated function (what other communities might call a "static
method"). Subsequent logging revealed that in this case we have a
`Def::Method`, whereas the lint pass was only matching on
`Def::Fn`. (One could argue that those def-names are thereby
misleading—must-use for self-ful methods have always worked—but
documenting or reworking that can be left to another day.)
src/liballoc/rc.rs
src/liballoc/sync.rs
src/librustc_lint/unused.rs
src/test/run-pass/resolve-pseudo-shadowing.rs
src/test/ui/fn_must_use.rs
src/test/ui/fn_must_use.stderr