Andrew Kelley
70894d5c2f
AstGen: fix loop result locations
...
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.
2021-12-27 15:30:31 -07:00
..
2021-12-27 15:30:31 -07:00
2021-04-29 15:54:04 -07:00
2021-04-29 15:54:04 -07:00
2021-04-29 15:54:04 -07:00
2021-04-29 15:54:04 -07:00
2021-09-01 17:54:07 -07:00
2021-11-22 20:30:20 -07:00
2021-11-22 20:30:20 -07:00
2021-10-22 17:50:36 -07:00
2021-05-08 14:45:21 -07:00
2021-10-21 19:05:26 -07:00
2021-10-21 19:05:26 -07:00
2021-10-04 23:48:55 -07:00
2021-12-19 00:24:45 -05:00
2021-10-13 18:43:43 -07:00
2021-06-21 17:03:03 -07:00
2021-10-28 18:33:13 -07:00
2021-11-10 12:39:47 -05:00
2021-06-21 17:03:03 -07:00
2021-10-26 16:43:18 -07:00
2021-10-26 16:43:18 -07:00
2021-05-08 14:45:21 -07:00
2021-10-28 17:33:05 -07:00
2021-09-01 15:41:29 -07:00
2021-05-08 14:45:21 -07:00
2021-10-02 20:15:03 -07:00
2021-10-02 20:15:03 -07:00
2021-12-19 00:24:45 -05:00
2021-11-30 00:13:07 -07:00
2021-11-22 04:36:57 +01:00
2021-08-30 18:50:07 -04:00
2021-10-02 20:15:03 -07:00
2021-10-02 20:15:03 -07:00
2021-10-02 20:15:03 -07:00
2021-12-27 01:14:50 -07:00
2021-12-27 01:14:50 -07:00
2021-12-27 01:14:50 -07:00
2021-11-22 03:21:31 +01:00
2021-11-22 03:21:31 +01:00
2021-12-21 01:47:27 +01:00
2021-12-21 01:47:27 +01:00
2021-05-08 14:45:21 -07:00
2021-10-20 15:34:10 -07:00
2021-10-20 15:34:10 -07:00
2021-05-08 14:45:21 -07:00
2021-05-08 14:45:21 -07:00
2021-11-27 00:27:52 -07:00
2021-11-27 00:27:52 -07:00
2021-12-27 15:30:31 -07:00
2021-12-27 15:30:31 -07:00
2021-11-22 04:36:57 +01:00
2021-11-22 04:36:57 +01:00
2021-05-08 14:45:21 -07:00
2021-05-08 14:45:21 -07:00
2021-10-02 20:15:03 -07:00
2021-10-28 17:23:02 -07:00
2021-11-27 00:27:52 -07:00
2021-05-08 14:45:21 -07:00
2021-11-16 17:46:39 -07:00
2021-06-21 17:03:03 -07:00
2021-06-21 17:03:03 -07:00
2021-12-21 01:47:27 +01:00
2021-12-21 01:47:27 +01:00
2021-10-14 21:17:30 -07:00
2021-09-28 12:00:35 -05:00
2021-04-29 15:54:04 -07:00
2021-10-22 15:53:59 -07:00
2021-12-01 17:30:41 -08:00
2021-10-04 23:48:55 -07:00
2021-11-02 12:45:29 -04:00
2021-10-17 17:02:20 -07:00
2021-11-27 00:27:52 -07:00
2021-11-23 13:46:56 -07:00
2021-11-26 23:17:01 -07:00
2021-11-26 23:17:01 -07:00
2021-11-30 00:13:07 -07:00
2021-11-16 16:51:31 -07:00
2021-10-29 17:49:02 -07:00
2021-10-29 17:49:02 -07:00
2021-12-11 00:29:31 +01:00
2021-12-19 00:24:45 -05:00
2021-10-21 22:56:11 -07:00
2021-05-08 14:45:21 -07:00
2021-05-08 14:45:21 -07:00
2021-06-21 17:03:03 -07:00
2021-12-08 15:25:31 -07:00
2021-10-22 15:53:59 -07:00
2021-07-26 20:05:48 -04:00
2021-09-01 15:41:29 -07:00
2021-10-04 23:48:55 -07:00
2021-10-04 23:48:55 -07:00
2021-06-21 17:03:03 -07:00
2021-10-25 20:41:15 +02:00
2021-10-25 20:41:15 +02:00
2021-10-25 20:41:15 +02:00
2021-05-08 14:45:21 -07:00
2021-05-08 14:45:21 -07:00
2021-05-08 14:45:21 -07:00
2021-12-23 23:57:02 -07:00
2021-12-23 23:57:02 -07:00
2021-11-30 16:15:42 -07:00
2021-05-08 14:45:21 -07:00
2021-05-08 14:45:21 -07:00
2021-10-26 22:41:19 -07:00
2021-10-26 22:41:19 -07:00
2021-09-23 13:17:06 -04:00
2021-12-19 00:24:45 -05:00
2021-08-06 09:10:50 +03:00
2021-09-20 20:51:31 -07:00
2021-12-08 15:25:31 -07:00
2021-07-06 12:42:18 +03:00
2021-05-08 14:45:21 -07:00
2021-06-21 17:03:03 -07:00
2021-12-19 00:24:45 -05:00
2021-09-20 02:29:04 +02:00
2021-07-28 18:17:11 -04:00
2021-11-27 00:27:52 -07:00
2021-10-02 20:15:03 -07:00
2021-10-26 22:41:19 -07:00
2021-10-02 20:15:03 -07:00
2021-10-26 22:41:19 -07:00
2021-11-30 16:15:42 -07:00
2021-06-21 17:03:03 -07:00
2021-10-04 23:48:55 -07:00
2021-06-21 17:03:03 -07:00
2021-05-08 14:45:21 -07:00
2021-12-27 15:30:31 -07:00
2021-12-27 15:30:31 -07:00
2021-10-13 18:43:43 -07:00