about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorChayim Refael Friedman <chayimfr@gmail.com>2024-10-06 18:14:07 +0300
committerChayim Refael Friedman <chayimfr@gmail.com>2024-10-20 19:09:51 +0300
commitb4f040331fbc524ee2180aaa33f4fb889ed2d988 (patch)
treefe609685d2c072dd2dcfca8759751843d7f4ab60 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentbac672c04be96b4cdda580a61730dc778acb0973 (diff)
downloadrust-b4f040331fbc524ee2180aaa33f4fb889ed2d988.tar.gz
rust-b4f040331fbc524ee2180aaa33f4fb889ed2d988.zip
Handle destructuring assignments uniformly
Instead of lowering them to `<expr> = <expr>`, then hacking on-demand to resolve them, we lower them to `<pat> = <expr>`, and use the pattern infrastructure to handle them. It turns out, destructuring assignments are surprisingly similar to pattern bindings, and so only minor modifications are needed.

This fixes few bugs that arose because of the non-uniform handling (for example, MIR lowering not handling slice and record patterns, and closure capture calculation not handling destructuring assignments at all), and furthermore, guarantees we won't have such bugs in the future, since the programmer will always have to explicitly handle `Expr::Assignment`.

Tests don't pass yet; that's because the generated patterns do not exist in the source map. The next commit will fix that.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions