about summary refs log tree commit diff
path: root/tests/ui/pattern/usefulness/integer-ranges/regression-switchint-sorting-with-ranges.rs
blob: bacb60a108bfc563d9604547821841bad199c5df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//@ run-pass
//
// Regression test for match lowering to MIR: when gathering candidates, by the time we get to the
// range we know the range will only match on the failure case of the switchint. Hence we mustn't
// add the `1` to the switchint or the range would be incorrectly sorted.
#![allow(unreachable_patterns)]
fn main() {
    match 1 {
        10 => unreachable!(),
        0..=5 => {}
        1 => unreachable!(),
        _ => unreachable!(),
    }
}