]> git.lizzy.rs Git - rust.git/commit
Auto merge of #75382 - JulianKnodt:match_branches, r=oli-obk
authorbors <bors@rust-lang.org>
Thu, 13 Aug 2020 19:26:35 +0000 (19:26 +0000)
committerbors <bors@rust-lang.org>
Thu, 13 Aug 2020 19:26:35 +0000 (19:26 +0000)
commit5e3f1b148db5bfa27fee52464ae1f5d34c49d77b
tree14f760bd76b3ed28ad68f4b34adf8a2f2ee7398c
parentb6396b75e782954acb085447fb836c4e0ff5281d
parent46e5699af97301fc89dadfa5633d6db814df3cc6
Auto merge of #75382 - JulianKnodt:match_branches, r=oli-obk

First iteration of simplify match branches

This is a simple MIR pass that attempts to convert
```
   bb0: {
        StorageLive(_2);
        _3 = discriminant(_1);
        switchInt(move _3) -> [0isize: bb2, otherwise: bb1];
    }

    bb1: {
        _2 = const false;
        goto -> bb3;
    }

    bb2: {
        _2 = const true;
        goto -> bb3;
    }
```
into
```
    bb0: {
        StorageLive(_2);
        _3 = discriminant(_1);
        _2 = _3 == 0;
        goto -> bb3;
    }
```
There are still missing components(like checking if the assignments are bools).
Was hoping that this could get some review though.

Handles #75141

r? @oli-obk