mirror of
https://github.com/ziglang/zig.git
synced 2024-12-03 10:28:48 +00:00
70894d5c2f
The main problem was that the loop body was treated as an expression that was one of the peer result values of a loop, when in reality the loop body is noreturn and only the `break` operands are the result values of loops. This was solved by introducing an override that prevents rvalue() from emitting a store to result location instruction for loop bodies. An orthogonal change also included in this commit is switching `elem_val` index expressions to using `coerced_ty` and doing the coercion to `usize` inside `Sema`, resulting in smaller ZIR (since the cast becomes implied). I also changed the break operand expression to use `reachableExpr`, introducing a new compile error for double break. This makes a few more behavior tests pass for `while` and `for` loops. |
||
---|---|---|
.. | ||
behavior | ||
src | ||
stage1/c_abi | ||
stage2 | ||
standalone | ||
assemble_and_link.zig | ||
behavior.zig | ||
cases.zig | ||
cli.zig | ||
compare_output.zig | ||
compile_errors.zig | ||
gen_h.zig | ||
run_translated_c.zig | ||
runtime_safety.zig | ||
stack_traces.zig | ||
standalone.zig | ||
tests.zig | ||
translate_c.zig |