Closed
Description
#![feature(never_type)]
use std::error::Error;
pub trait Deserialize: Sized {
fn deserialize() -> Result<Self, Box<Error>>;
}
impl Deserialize for ! {
fn deserialize() -> Result<!, Box<Error>> {
Err("oh geez")?;
panic!()
}
}
fn foo() -> Result<usize, Box<Error>> {
Deserialize::deserialize()?;
Ok(22)
}
In this code, the Ok(22)
is unreachable. This should raise a warning but it currently doesn't.