Calling get variable expression will return an expression but we are
checking for unused decls so lets actually pass the decl.
Addresses #2188
gcc/rust/ChangeLog:
* checks/lints/rust-lint-unused-var.cc (UnusedVariables::Lint): use the decl not the expr
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
// <http://www.gnu.org/licenses/>.
#include "rust-lint-unused-var.h"
-#include "print-tree.h"
+#include "rust-gcc.h"
namespace Rust {
namespace Analysis {
for (auto &var : ctx.get_var_decls ())
{
- tree t = ctx.get_backend ()->var_expression (var, Location ());
- check_decl (&t);
+ tree decl = var->get_decl ();
+ check_decl (&decl);
}
for (auto &const_decl : ctx.get_const_decls ())