mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 03:03:21 +00:00
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:
parent
bb33200047
commit
0f10acf768
20
tests/ui/coroutine/return-types-diverge.rs
Normal file
20
tests/ui/coroutine/return-types-diverge.rs
Normal 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() {}
|
Loading…
Reference in New Issue
Block a user