rust/tests
León Orell Valerian Liehr e111e99253
Rollup merge of #126553 - Nadrieril:expand-or-pat-into-above, r=matthewjasper
match lowering: expand or-candidates mixed with candidates above

This PR tweaks match lowering of or-patterns. Consider this:
```rust
match (x, y) {
    (1, true) => 1,
    (2, false) => 2,
    (1 | 2, true | false) => 3,
    (3 | 4, true | false) => 4,
    _ => 5,
}
```
One might hope that this can be compiled to a single `SwitchInt` on `x` followed by some boolean checks. Before this PR, we compile this to 3 `SwitchInt`s on `x`, because an arm that contains more than one or-pattern was compiled on its own. This PR groups branch `3` with the two branches above, getting us down to 2 `SwitchInt`s on `x`.

We can't in general expand or-patterns freely, because this interacts poorly with another optimization we do: or-pattern simplification. When an or-pattern doesn't involve bindings, we branch the success paths of all its alternatives to the same block. The drawback is that in a case like:
```rust
match (1, true) {
    (1 | 2, false) => unreachable!(),
    (2, _) => unreachable!(),
    _ => {}
}
```
if we used a single `SwitchInt`, by the time we test `false` we don't know whether we came from the `1` case or the `2` case, so we don't know where to go if `false` doesn't match.

Hence the limitation: we can process or-pattern alternatives alongside candidates that precede it, but not candidates that follow it. (Unless the or-pattern is the only remaining match pair of its candidate, in which case we can process it alongside whatever).

This PR allows the processing of or-pattern alternatives alongside candidates that precede it. One benefit is that we now process or-patterns in a single place in `mod.rs`.

r? ``@matthewjasper``
2024-06-19 09:52:00 +02:00
..
assembly Add i686-unknown-redox target 2024-06-16 12:56:48 +00:00
auxiliary
codegen Apply suggestion. 2024-06-16 17:19:25 +08:00
codegen-units Detect pub structs never constructed and unused associated constants in traits 2024-06-05 23:20:09 +08:00
coverage Rollup merge of #126621 - Zalathar:test-coverage-attr, r=petrochenkov 2024-06-18 15:30:47 +02:00
coverage-run-rustdoc
crashes Auto merge of #126593 - matthiaskrgr:rollup-a5jfg7w, r=matthiaskrgr 2024-06-17 14:22:10 +00:00
debuginfo Add debuginfo tests for collapse_debuginfo for statics. 2024-06-13 16:04:31 +02:00
incremental Update tests/incremental/foreign.rs 2024-05-20 11:13:10 -04:00
mir-opt Expand or-candidates mixed with candidates above 2024-06-16 18:39:50 +02:00
pretty Auto merge of #125918 - oli-obk:const_block_ice, r=compiler-errors 2024-06-07 09:08:59 +00:00
run-make Rollup merge of #125787 - Oneirical:infinite-test-a-novel, r=jieyouxu 2024-06-19 09:52:00 +02:00
run-pass-valgrind rustfmt tests/run-pass-valgrind/. 2024-06-04 09:53:02 +10:00
rustdoc Update code format and tests 2024-06-04 13:49:39 +02:00
rustdoc-gui Remove failing GUI test to stop blocking CI until it is fixed 2024-06-14 00:49:05 +02:00
rustdoc-js rustdoc-search: use lowercase, non-normalized name for type search 2024-06-09 11:56:52 -07:00
rustdoc-js-std Update tests 2024-06-07 11:55:52 +08:00
rustdoc-json rustfmt tests/rustdoc-json/. 2024-06-04 14:15:19 +10:00
rustdoc-ui Suggest standalone doctest for non-local impl defs 2024-06-15 13:00:53 +02:00
ui Rollup merge of #126553 - Nadrieril:expand-or-pat-into-above, r=matthewjasper 2024-06-19 09:52:00 +02:00
ui-fulldeps Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
COMPILER_TESTS.md