e2807a4565
This is the second of two parts of #8991, now possible as a new snapshot has been made. (The first part implemented the unreachable!() macro; it was #8992, 6b7b8f2682.) ``std::util::unreachable()`` is removed summarily; any code which used it should now use the ``unreachable!()`` macro. Closes #9312. Closes #8991.
29 lines
532 B
Rust
29 lines
532 B
Rust
fn a() {
|
|
let x = [1, 2, 3];
|
|
match x {
|
|
[1, 2, 4] => unreachable!(),
|
|
[0, 2, 3, .._] => unreachable!(),
|
|
[0, .._, 3] => unreachable!(),
|
|
[0, .._] => unreachable!(),
|
|
[1, 2, 3] => (),
|
|
[_, _, _] => unreachable!(),
|
|
}
|
|
match x {
|
|
[.._] => (),
|
|
}
|
|
match x {
|
|
[_, _, _, .._] => (),
|
|
}
|
|
match x {
|
|
[a, b, c] => {
|
|
assert_eq!(1, a);
|
|
assert_eq!(2, b);
|
|
assert_eq!(3, c);
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
a();
|
|
}
|