diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-04-16 16:32:35 +0200 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2025-04-30 10:35:43 +0000 |
commit | 515e1692ffe87852ae68fab2715a64e6bf0477a2 (patch) | |
tree | 471a34c04bdf345b5b2fdec17431edeb32091fe0 /gcc/cppfiles.c | |
parent | 0a316f44a0811b54b72aa68997ee62a66ff54ebe (diff) | |
download | gcc-515e1692ffe87852ae68fab2715a64e6bf0477a2.zip gcc-515e1692ffe87852ae68fab2715a64e6bf0477a2.tar.gz gcc-515e1692ffe87852ae68fab2715a64e6bf0477a2.tar.bz2 |
backend: Compile struct rebinding patterns
Allow matching on a struct instance and rebinding its fields to new names:
match X {
Foo {
field0: new_name0,
field1: new_name1,
} => {
do_something(new_name0, new_name1);
},
}
This will enable us to finish derives for PartialEq and PartialOrd but
isn't a complete implementation of these patterns yet.
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc (CompilePatternBindings::make_struct_access):
New function.
(CompilePatternBindings::visit): Properly implement patterns mentioned above
and call make_struct_accesss.
* backend/rust-compile-pattern.h: New declaration.
gcc/testsuite/ChangeLog:
* rust/execute/torture/struct_pattern1.rs: New test.
Diffstat (limited to 'gcc/cppfiles.c')
0 files changed, 0 insertions, 0 deletions