public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #1611
@ 2022-12-05 9:53 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-12-05 9:53 UTC (permalink / raw)
To: gcc-cvs
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(-)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-05 9:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 9:53 [gcc/devel/rust/master] Merge #1611 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).