]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Add HIR lowering support for rest pattern in struct patterns' AST
authorYap Zhi Heng <yapzhhg@gmail.com>
Mon, 22 Sep 2025 13:29:41 +0000 (21:29 +0800)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 30 Oct 2025 20:30:53 +0000 (21:30 +0100)
commit54ff78002e744490ac8b900a3e6282993eb86846
tree43b4de9605376e452e691a91407e9c2bdcb0f746
parent0c714ad621154c6b746712c7f64ead0628f67b0f
gccrs: Add HIR lowering support for rest pattern in struct patterns' AST

gcc/rust/ChangeLog:

* ast/rust-pattern.h (StructPatternElements): Rename has_struct_pattern_etc
to has_rest_pattern, and has_etc to has_rest to signify presense of rest
patterns more clearly.
* ast/rust-pattern.cc (StructPatternElements::as_string): Rename variables
accordingly.
* ast/rust-ast-collector.cc: Rename variables accordingly.
* expand/rust-cfg-strip.cc: Rename variables accordingly.
* parse/rust-parse-impl.h: Rename variable accordingly.
* hir/tree/rust-hir-pattern.h (StructPatternElements): Add a boolean to track
presense of rest pattern.
* hir/rust-ast-lower-pattern.cc (visit(StructPattern)): Add support for
lowering rest pattern to HIR.
* typecheck/rust-hir-type-check-pattern.cc (visit(StructPattern)): Remove
size check when rest pattern is present.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
gcc/rust/ast/rust-ast-collector.cc
gcc/rust/ast/rust-pattern.cc
gcc/rust/ast/rust-pattern.h
gcc/rust/expand/rust-cfg-strip.cc
gcc/rust/hir/rust-ast-lower-pattern.cc
gcc/rust/hir/tree/rust-hir-pattern.h
gcc/rust/parse/rust-parse-impl.h
gcc/rust/typecheck/rust-hir-type-check-pattern.cc
gcc/testsuite/rust/compile/issue-3929-1.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/issue-3929-2.rs [new file with mode: 0644]