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] Lower StructPatternFieldIdentPat
Date: Tue,  2 May 2023 07:11:54 +0000 (GMT)	[thread overview]
Message-ID: <20230502071154.A13443858423@sourceware.org> (raw)

https://gcc.gnu.org/g:4051d11a7d06e475bccf6c89ef01c605445e210a

commit 4051d11a7d06e475bccf6c89ef01c605445e210a
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Wed Apr 26 22:14:53 2023 -0400

    Lower StructPatternFieldIdentPat
    
    gcc/rust/ChangeLog:
    
            * hir/rust-ast-lower-pattern.cc
            (ASTLoweringPattern::visit): Lower StructPatternFieldIdentPat.
    
    Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

Diff:
---
 gcc/rust/hir/rust-ast-lower-pattern.cc | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/hir/rust-ast-lower-pattern.cc b/gcc/rust/hir/rust-ast-lower-pattern.cc
index b37d66395d5..5b880b22f39 100644
--- a/gcc/rust/hir/rust-ast-lower-pattern.cc
+++ b/gcc/rust/hir/rust-ast-lower-pattern.cc
@@ -128,8 +128,23 @@ ASTLoweringPattern::visit (AST::StructPattern &pattern)
 	  break;
 
 	  case AST::StructPatternField::ItemType::IDENT_PAT: {
-	    // TODO
-	    gcc_unreachable ();
+	    AST::StructPatternFieldIdentPat &ident
+	      = static_cast<AST::StructPatternFieldIdentPat &> (*field);
+
+	    auto crate_num = mappings->get_current_crate ();
+	    Analysis::NodeMapping mapping (crate_num, ident.get_node_id (),
+					   mappings->get_next_hir_id (
+					     crate_num),
+					   UNKNOWN_LOCAL_DEFID);
+
+	    std::unique_ptr<HIR::Pattern> pat (ASTLoweringPattern::translate (
+	      ident.get_ident_pattern ().get ()));
+
+	    f = new HIR::StructPatternFieldIdentPat (mapping,
+						     ident.get_identifier (),
+						     std::move (pat),
+						     ident.get_outer_attrs (),
+						     ident.get_locus ());
 	  }
 	  break;

                 reply	other threads:[~2023-05-02  7:11 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=20230502071154.A13443858423@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).