2024-01-18 09:16:30 -06:00
|
|
|
#![feature(never_patterns)]
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
#![deny(unreachable_patterns)]
|
|
|
|
#![deny(unreachable_code)]
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
enum Void {}
|
|
|
|
|
|
|
|
fn never_arg(!: Void) -> u32 {
|
|
|
|
println!();
|
|
|
|
//~^ ERROR unreachable statement
|
|
|
|
}
|
|
|
|
|
|
|
|
fn ref_never_arg(&!: &Void) -> u32 {
|
|
|
|
println!();
|
|
|
|
//~^ ERROR unreachable statement
|
|
|
|
}
|
|
|
|
|
2024-01-18 11:22:08 -06:00
|
|
|
fn never_let() -> u32 {
|
|
|
|
let ptr: *const Void = std::ptr::null();
|
|
|
|
unsafe {
|
|
|
|
let ! = *ptr;
|
|
|
|
}
|
|
|
|
println!();
|
|
|
|
//~^ ERROR unreachable statement
|
|
|
|
}
|
2024-01-18 09:16:30 -06:00
|
|
|
|
|
|
|
fn never_match() -> u32 {
|
|
|
|
let ptr: *const Void = std::ptr::null();
|
|
|
|
unsafe {
|
|
|
|
match *ptr { ! };
|
|
|
|
}
|
|
|
|
println!();
|
|
|
|
//~^ ERROR unreachable statement
|
|
|
|
}
|