]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Lower IdentifierPattern's to_bind to HIR
authorZhi Heng <yapzhhg@gmail.com>
Sat, 7 Jun 2025 14:30:25 +0000 (22:30 +0800)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:45 +0000 (16:36 +0200)
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 <yapzhhg@gmail.com>
gcc/rust/hir/rust-ast-lower-pattern.cc
gcc/rust/hir/rust-hir-dump.cc

index 9be36c8f2a09702c80a402b46caaa9167c22e9e5..cbb2e4c1fa34a7ef139f1af5bf00fc4ab6a0e701 100644 (file)
@@ -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 (),
index ee5765e280c5f071aa9907e2f498c320977a0a9c..984e626b90a943f6c8c3c8107ff251840eb7a9fb 100644 (file)
@@ -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");