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] Merge #1611 Date: Mon, 5 Dec 2022 09:53:22 +0000 (GMT) [thread overview] Message-ID: <20221205095322.6260F3818FCE@sourceware.org> (raw) https://gcc.gnu.org/g:e39fadcd0aa4d52d53667e2adad9a6677f7e9adf commit e39fadcd0aa4d52d53667e2adad9a6677f7e9adf Merge: 22329b03a6e 3053ec36609 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Sun Dec 4 22:02:22 2022 +0000 Merge #1611 1611: Initial state capture for closures r=philberty a=philberty This patch set adds the initial support closure captures, move semantics are not handled here. We track what variables are being captured by a closure during name resolution so that when a VAR_DECL is resolved, we check if we are inside a closure context node_id which is the same id as its associated rib id. So when we resolve a name that resides in an outermost rib we can add this to set of node-id's that are captured by this closure. There is a gap here for the case where we need to check if it is inside a nested function and that function contains closures which could wrongly capture variables in the enclosing function. This will also be a problem for nested functions in general. Fixes #195 Co-authored-by: Philip Herron <philip.herron@embecosm.com> Diff: gcc/rust/backend/rust-compile-context.cc | 47 +++++ gcc/rust/backend/rust-compile-context.h | 9 + gcc/rust/backend/rust-compile-expr.cc | 50 ++++- gcc/rust/backend/rust-compile-resolve-path.cc | 8 + gcc/rust/backend/rust-compile-type.cc | 31 +++- gcc/rust/resolve/rust-ast-resolve-expr.cc | 23 ++- gcc/rust/resolve/rust-ast-resolve-implitem.h | 12 +- gcc/rust/resolve/rust-ast-resolve-item.cc | 19 +- gcc/rust/resolve/rust-ast-resolve-pattern.cc | 2 +- gcc/rust/resolve/rust-ast-resolve-pattern.h | 12 +- gcc/rust/resolve/rust-ast-resolve-stmt.h | 19 +- gcc/rust/resolve/rust-ast-resolve-toplevel.h | 21 ++- gcc/rust/resolve/rust-ast-resolve-type.h | 2 +- gcc/rust/resolve/rust-name-resolver.cc | 241 ++++++++++++++++++++----- gcc/rust/resolve/rust-name-resolver.h | 49 ++++- gcc/rust/typecheck/rust-hir-type-check-expr.cc | 4 +- gcc/rust/typecheck/rust-tyty.cc | 5 +- gcc/rust/typecheck/rust-tyty.h | 11 +- gcc/testsuite/rust/execute/torture/closure3.rs | 33 ++++ 19 files changed, 498 insertions(+), 100 deletions(-)
reply other threads:[~2022-12-05 9:53 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=20221205095322.6260F3818FCE@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: linkBe 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).