Stream: t-compiler

Topic: No `FakeRead` emitted for `match` scrutinee?

ecstatic-morse (Nov 05 2019 at 04:23, on Zulip):

The MIR builder docs suggest that a FakeRead will always be emitted for the scrutinee of a match statement, but this seems not to be true in practice. Is this expected behavior?

ecstatic-morse (Nov 05 2019 at 04:26, on Zulip): uses the presence of a FakeRead to forbid if and match in consts (it also forbids basic blocks with multiple predecessors in the control-flow graph, which is the check that catches most match statements).

ecstatic-morse (Nov 05 2019 at 04:31, on Zulip):

I assumed that FakeReads were getting stripped somewhere, but I was trying to modify the logic in check_consts and it appears as though they aren't present at all for some match statements.

ecstatic-morse (Nov 05 2019 at 04:33, on Zulip):

It would be best to not look for FakeRead at all and instead look only at SwitchInt when checking const bodies, but the span assigned to a SwitchInt terminator for a match is weird: it points to the pattern for the first arm.

ecstatic-morse (Nov 05 2019 at 05:48, on Zulip):

Just ignore me. The weird span was causing me to miss the error from the fakeread

Last update: Jul 02 2020 at 13:50UTC