aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-10-19 18:30:36 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-10-20 16:06:09 +0100
commite637c0445bc4633a1a6ab1d5c32e3ee82cf03152 (patch)
tree21d3f7c2868074b037210f226612798b725d4caf /gcc
parent662a7a90305f3c5df24765ec6de6c4e56187ae1a (diff)
downloadgcc-e637c0445bc4633a1a6ab1d5c32e3ee82cf03152.zip
gcc-e637c0445bc4633a1a6ab1d5c32e3ee82cf03152.tar.gz
gcc-e637c0445bc4633a1a6ab1d5c32e3ee82cf03152.tar.bz2
Add closures to lints and error checking
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/checks/errors/rust-const-checker.cc4
-rw-r--r--gcc/rust/checks/errors/rust-unsafe-checker.cc4
-rw-r--r--gcc/rust/checks/lints/rust-lint-marklive.h5
3 files changed, 11 insertions, 2 deletions
diff --git a/gcc/rust/checks/errors/rust-const-checker.cc b/gcc/rust/checks/errors/rust-const-checker.cc
index 4b4350e..3254a98 100644
--- a/gcc/rust/checks/errors/rust-const-checker.cc
+++ b/gcc/rust/checks/errors/rust-const-checker.cc
@@ -383,7 +383,9 @@ ConstChecker::visit (FieldAccessExpr &expr)
void
ConstChecker::visit (ClosureExpr &expr)
-{}
+{
+ expr.get_expr ()->accept_vis (*this);
+}
void
ConstChecker::visit (BlockExpr &expr)
diff --git a/gcc/rust/checks/errors/rust-unsafe-checker.cc b/gcc/rust/checks/errors/rust-unsafe-checker.cc
index 8dff50b..55a2159 100644
--- a/gcc/rust/checks/errors/rust-unsafe-checker.cc
+++ b/gcc/rust/checks/errors/rust-unsafe-checker.cc
@@ -454,7 +454,9 @@ UnsafeChecker::visit (FieldAccessExpr &expr)
void
UnsafeChecker::visit (ClosureExpr &expr)
-{}
+{
+ expr.get_expr ()->accept_vis (*this);
+}
void
UnsafeChecker::visit (BlockExpr &expr)
diff --git a/gcc/rust/checks/lints/rust-lint-marklive.h b/gcc/rust/checks/lints/rust-lint-marklive.h
index 119af8b..ed5ed13 100644
--- a/gcc/rust/checks/lints/rust-lint-marklive.h
+++ b/gcc/rust/checks/lints/rust-lint-marklive.h
@@ -285,6 +285,11 @@ public:
item->accept_vis (*this);
}
+ void visit (HIR::ClosureExpr &expr) override
+ {
+ expr.get_expr ()->accept_vis (*this);
+ }
+
private:
std::vector<HirId> worklist;
std::set<HirId> liveSymbols;