public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] Add closures to lints and error checking
Date: Sat, 22 Oct 2022 10:48:06 +0000 (GMT)	[thread overview]
Message-ID: <20221022104806.7D8473858C33@sourceware.org> (raw)

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;

                 reply	other threads:[~2022-10-22 10:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221022104806.7D8473858C33@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).