Skip to content

gccrs: Implement compilation for let <StructPattern> - #4773

Open
Polygonalr wants to merge 1 commit into
Rust-GCC:masterfrom
Polygonalr:let-struct-pattern
Open

gccrs: Implement compilation for let <StructPattern>#4773
Polygonalr wants to merge 1 commit into
Rust-GCC:masterfrom
Polygonalr:let-struct-pattern

Conversation

@Polygonalr

Copy link
Copy Markdown
Contributor

No description provided.

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a first glance this looks good to me, I'll leave it to someone else to review and merge though as I'll be away for a few days and don't want to block this. Thank you!

Comment thread gcc/testsuite/rust/compile/let-structpattern.rs Outdated
@Polygonalr
Polygonalr marked this pull request as ready for review August 16, 2026 13:52
@Polygonalr Polygonalr changed the title gccrs: Compile IDENT_PAT and IDENT cases for let <StructPattern> gccrs: Implement compilation for let <StructPattern> Aug 16, 2026
let Foo {x: another_x} = my_foo;
my_foo.x = 16;
let Foo {x: yet_another_x } = my_foo;
let Bar {0: w, ..} = my_bar;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add a binding pattern (@) test within a let ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a binding pattern to the execute test, see whether that is what you're looking for

gcc/rust/ChangeLog:

	* backend/rust-compile-var-decl.h (CompileVarDecl::visit (StructPattern)): Compile
	variable declarations for use within CompilePatternLet::visit(StructPattern).
	* backend/rust-compile-pattern.h (CompilePatternLet::visit (StructPattern)):
	Remove rust_sorry_at.
	* backend/rust-compile-pattern.cc (CompilePatternLet::visit (StructPattern)):
	Compile bindings for struct fields.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants