Description
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.
Metadata
Metadata
Assignees
Labels
Area: Async & AwaitAsync-await issues that are part of the "polish" areaCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessHigh priorityRelevant to the compiler team, which will review and decide on the PR/issue.