https://gcc.gnu.org/g:3d50a05bba55f5e76d1b6498f37d5b71d197cd54

commit r16-2838-g3d50a05bba55f5e76d1b6498f37d5b71d197cd54
Author: Zhi Heng <yapz...@gmail.com>
Date:   Sat Jun 7 22:30:25 2025 +0800

    gccrs: Lower IdentifierPattern's to_bind to HIR
    
    gcc/rust/ChangeLog:
    
            * hir/rust-ast-lower-pattern.cc: Lower of IdentifierPattern's 
to_bind to HIR.
            * hir/rust-hir-dump.cc: Update IdentifierPattern's dump to properly 
show to_bind's full
            full properties.
    
    Signed-off-by: Yap Zhi Heng <yapz...@gmail.com>

Diff:
---
 gcc/rust/hir/rust-ast-lower-pattern.cc | 5 +++++
 gcc/rust/hir/rust-hir-dump.cc          | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/hir/rust-ast-lower-pattern.cc 
b/gcc/rust/hir/rust-ast-lower-pattern.cc
index 9be36c8f2a09..cbb2e4c1fa34 100644
--- a/gcc/rust/hir/rust-ast-lower-pattern.cc
+++ b/gcc/rust/hir/rust-ast-lower-pattern.cc
@@ -50,6 +50,11 @@ ASTLoweringPattern::visit (AST::IdentifierPattern &pattern)
                                 UNKNOWN_LOCAL_DEFID);
 
   std::unique_ptr<Pattern> to_bind;
+  if (pattern.has_pattern_to_bind ())
+    {
+      to_bind = std::unique_ptr<Pattern> (
+       ASTLoweringPattern::translate (pattern.get_pattern_to_bind ()));
+    }
   translated
     = new HIR::IdentifierPattern (mapping, pattern.get_ident (),
                                  pattern.get_locus (), pattern.get_is_ref (),
diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc
index ee5765e280c5..984e626b90a9 100644
--- a/gcc/rust/hir/rust-hir-dump.cc
+++ b/gcc/rust/hir/rust-hir-dump.cc
@@ -2116,7 +2116,7 @@ Dump::visit (IdentifierPattern &e)
   put_field ("mut", std::to_string (e.is_mut ()));
 
   if (e.has_pattern_to_bind ())
-    put_field ("to_bind", e.get_to_bind ().as_string ());
+    visit_field ("to_bind", e.get_to_bind ());
   else
     put_field ("to_bind", "none");

Reply via email to