public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Add closures to lints and error checking
@ 2022-10-22 10:48 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-10-22 10:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e637c0445bc4633a1a6ab1d5c32e3ee82cf03152
commit e637c0445bc4633a1a6ab1d5c32e3ee82cf03152
Author: Philip Herron <philip.herron@embecosm.com>
Date: Wed Oct 19 18:30:36 2022 +0100
Add closures to lints and error checking
Diff:
---
gcc/rust/checks/errors/rust-const-checker.cc | 4 +++-
gcc/rust/checks/errors/rust-unsafe-checker.cc | 4 +++-
gcc/rust/checks/lints/rust-lint-marklive.h | 5 +++++
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 4b4350e881f..3254a982b91 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 8dff50b38f1..55a21590b2e 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 119af8b8c95..ed5ed13c21e 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-22 10:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22 10:48 [gcc/devel/rust/master] Add closures to lints and error checking Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).