2021-08-02 00:18:50 +00:00
|
|
|
fn main() {
|
|
|
|
let Some(x) = Some(1) else { //~ ERROR does not diverge
|
|
|
|
Some(2)
|
|
|
|
};
|
|
|
|
let Some(x) = Some(1) else { //~ ERROR does not diverge
|
|
|
|
if 1 == 1 {
|
|
|
|
panic!();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
let Some(x) = Some(1) else { Some(2) }; //~ ERROR does not diverge
|
2022-10-07 00:42:02 +00:00
|
|
|
|
|
|
|
// Ensure that uninhabited types do not "diverge".
|
|
|
|
// This might be relaxed in the future, but when it is,
|
2022-10-21 09:40:36 +00:00
|
|
|
// it should be an explicitly wanted decision.
|
2022-10-07 00:42:02 +00:00
|
|
|
let Some(x) = Some(1) else { foo::<Uninhabited>() }; //~ ERROR does not diverge
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Uninhabited {}
|
|
|
|
|
|
|
|
fn foo<T>() -> T {
|
|
|
|
panic!()
|
2021-08-02 00:18:50 +00:00
|
|
|
}
|