The following code crashes with an illegal instruction, presumably because all the code after contains_never is considered unreachable:
#![feature(futures_api, async_await, await_macro)]
pub enum Uninhabited { }
fn uninhabited_async() -> Uninhabited {
unreachable!()
}
async fn noop() { }
async fn contains_never() {
let error = uninhabited_async();
await!(noop());
let error2 = error;
}
fn main() {
contains_never();
}
It seems the root cause is that the struct representing the future contains a field of type Uninhabited as it is preserved across the (unreachable) yield point and thus is considered uninhabited itself, despite being perfectly constructible.
The following code crashes with an illegal instruction, presumably because all the code after
contains_neveris considered unreachable:It seems the root cause is that the struct representing the future contains a field of type
Uninhabitedas it is preserved across the (unreachable) yield point and thus is considered uninhabited itself, despite being perfectly constructible.