You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support labeled block value breaks in HIR lowering
This change implements backend lowering support for Rust labeled blocks.
Previously, labeled blocks were rejected in "CompileExpr::visit(BlockExpr)"
as unsupported. With this patch, labeled blocks are lowered by introducing
the following :-
1. A backend "LABEL_DECL" used as the jump target for "break 'label".
2. A temporary "Bvariable" used to hold the block’s resulting value.
gcc/rust/ChangeLog:
* backend/rust-compile-context.h: Insert/Lookup block temp variables.
* backend/rust-compile-expr.cc (CompileExpr::visit): Lower labeled block.
(CompileExpr::construct_block_label): Utility function to construct block label.
(CompileExpr::lookup_label): Utility function to lookup label.
(CompileExpr::lookup_temp_var): Utility function to lookup block temp variables.
(CompileExpr::resolve_util): Utility to resolve NodeId to HirId.
* backend/rust-compile-expr.h: Header functions.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Fix label resolution.
gcc/testsuite/ChangeLog:
* rust/execute/cf-labeled-block.rs: New test.
Signed-off-by: Islam-Imad <islamimad404@gmail.com>
0 commit comments