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?
qualify_consts.rs uses the presence of a
FakeRead to forbid
match in consts (it also forbids basic blocks with multiple predecessors in the control-flow graph, which is the check that catches most
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.
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.
Just ignore me. The weird span was causing me to miss the error from the fakeread