]> git.lizzy.rs Git - rust.git/commit
in which the fn-must-use codepath is prevented from panicking on closure
authorZack M. Davis <code@zackmdavis.net>
Sat, 10 Mar 2018 22:26:33 +0000 (14:26 -0800)
committerZack M. Davis <code@zackmdavis.net>
Sun, 29 Apr 2018 03:32:49 +0000 (20:32 -0700)
commitc659faba8d8a7e21eeddbf446c9101bb945e9f0c
tree2098b56611e6f0314e9e820cedde61025416ed0d
parentf4c1f0ce93137049bd6c25d3289bf12bfc00426d
in which the fn-must-use codepath is prevented from panicking on closure

The must-use lint needs the DefId of called functions and method
receivers in order to look for a `#[must_use]` attribute, but this would
ICE (!) if a called function was actually a closure (with a non-unit
return value). Instead, let's be specific that we want a `Def::Fn`,
rather than blithely assuming that we can get the DefId of a qpath.

Supporting must-use closures doesn't seem like a priority, but could
conceivably be added in the future if desired (conditional on the
statement and expression attributes (#15701) story being amicable).
src/librustc_lint/unused.rs