blob: 321b864aa27de8ffe53dc1e9983c7970e9d4656b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
//@ aux-build: staged-api.rs
//! The field of `Pin` used to be public, which would cause `Pin<Void>` to be uninhabited. To remedy
//! this, we temporarily made it so unstable fields are always considered inhabited. This has now
//! been reverted, and this file ensures that we don't special-case unstable fields wrt
//! inhabitedness anymore.
#![feature(exhaustive_patterns)]
#![feature(never_type)]
#![feature(my_coro_state)] // Custom feature from `staged-api.rs`
#![deny(unreachable_patterns)]
extern crate staged_api;
use staged_api::{Foo, MyCoroutineState};
enum Void {}
fn demo(x: Foo<Void>) {
match x {}
}
// Ensure that the pattern is considered unreachable.
fn demo2(x: Foo<Void>) {
match x {
Foo { .. } => {} //~ ERROR unreachable
}
}
// Same as above, but for wildcard.
fn demo3(x: Foo<Void>) {
match x {
_ => {} //~ ERROR unreachable
}
}
fn unstable_enum(x: MyCoroutineState<i32, !>) {
match x {
MyCoroutineState::Yielded(_) => {}
}
match x {
MyCoroutineState::Yielded(_) => {}
MyCoroutineState::Complete(_) => {} //~ ERROR unreachable
}
}
fn main() {}
|