Add a test demonstrating that RFC's note on diverging returns is subsumed by just inferring unit as ret type

This commit is contained in:
Michael Goulet 2023-12-18 23:17:58 +00:00
parent bb33200047
commit 0f10acf768

View File

@ -0,0 +1,20 @@
// compile-flags: --edition 2024 -Zunstable-options
// check-pass
#![feature(gen_blocks)]
fn diverge() -> ! { loop {} }
async gen fn async_gen_fn() -> i32 { diverge() }
gen fn gen_fn() -> i32 { diverge() }
fn async_gen_block() {
async gen { yield (); diverge() };
}
fn gen_block() {
gen { yield (); diverge() };
}
fn main() {}