From: Zhi Heng Date: Sat, 7 Jun 2025 14:30:25 +0000 (+0800) Subject: gccrs: Lower IdentifierPattern's to_bind to HIR X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3d50a05bba55f5e76d1b6498f37d5b71d197cd54;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/rust/hir/rust-ast-lower-pattern.cc b/gcc/rust/hir/rust-ast-lower-pattern.cc index 9be36c8f2a0..cbb2e4c1fa3 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 to_bind; + if (pattern.has_pattern_to_bind ()) + { + to_bind = std::unique_ptr ( + 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 ee5765e280c..984e626b90a 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");