Enable compilation of `let` bindings with struct patterns in gccrs
gccrs now supports compiling `let` statements that use struct patterns for variable destructuring.
gccrs has been updated to support the compilation of let statements that utilize struct patterns. This enables destructuring of struct fields directly into variables, improving ergonomics for Rust developers. The changes involve modifications in rust-compile-var-decl.h and rust-compile-pattern.cc.
In Details
This commit enhances gccrs' backend by enabling the compilation of let statements involving StructPattern. It specifically updates CompileVarDecl::visit(StructPattern) to compile variable declarations for struct destructuring and modifies CompilePatternLet::visit(StructPattern) to handle the bindings of struct fields, removing a rust_sorry_at placeholder.
- struct pattern
- In Rust, a pattern that destructures a struct, allowing you to bind variables to its fields. For example,
let Point { x, y } = p;. - destructuring
- The process of unpacking values from data structures (like tuples, structs, or enums) into individual variables.