]> git.ipfire.org Git - thirdparty/gcc.git/commit
Improve struct pattern compilation
authorOwen Avery <powerboat9.gamer@gmail.com>
Thu, 1 May 2025 01:54:53 +0000 (21:54 -0400)
committerPhilip Herron <philip.herron@embecosm.com>
Wed, 7 May 2025 15:34:59 +0000 (15:34 +0000)
commit23f933b90bb7d5558eef4d956d2a76160beb0e12
tree1b75b995927a1da03092ecb2459715e2ce2bd89a
parent8592769349a33ff1fca3777021ad6ea8dab56c7d
Improve struct pattern compilation

gcc/rust/ChangeLog:

* backend/rust-compile-pattern.cc
(CompilePatternCheckExpr::visit): Fix GENERIC generation in
light of enum layout changes since this code was written.
(CompilePatternBindings::handle_struct_pattern_ident_pat):
Delegate handling of child patterns to another
CompilePatternBindings::Compile call.
(CompilePatternBindings::make_struct_access): Make field name
parameter const qualified.
* backend/rust-compile-pattern.h
(CompilePatternBindings::make_struct_access): Likewise.

gcc/testsuite/ChangeLog:

* rust/execute/torture/struct-pattern-match.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/backend/rust-compile-pattern.cc
gcc/rust/backend/rust-compile-pattern.h
gcc/testsuite/rust/execute/torture/struct-pattern-match.rs [new file with mode: 0644]