rust/src/test/ui/unreachable/unreachable-loop-patterns.rs

23 lines
350 B
Rust
Raw Normal View History

2018-11-20 22:49:48 +00:00
// compile-fail
#![feature(never_type)]
#![feature(exhaustive_patterns)]
2018-11-20 22:49:48 +00:00
#![allow(unreachable_code)]
#![deny(unreachable_patterns)]
2018-11-20 22:49:48 +00:00
enum Void {}
impl Iterator for Void {
type Item = Void;
2018-11-20 22:49:48 +00:00
fn next(&mut self) -> Option<Void> {
None
}
}
fn main() {
for _ in unimplemented!() as Void {}
//~^ ERROR unreachable pattern
}