rust/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
651 B
Rust
Raw Normal View History

2024-05-05 21:39:07 +00:00
//@ edition: 2024
//@ compile-flags: -Z unstable-options
#![feature(gen_blocks)]
#![feature(async_closure)]
async fn async_fn() {
break; //~ ERROR `break` inside `async` function
}
gen fn gen_fn() {
break; //~ ERROR `break` inside `gen` function
}
async gen fn async_gen_fn() {
break; //~ ERROR `break` inside `async gen` function
}
fn main() {
let _ = async { break; }; //~ ERROR `break` inside `async` block
let _ = async || { break; }; //~ ERROR `break` inside `async` closure
let _ = gen { break; }; //~ ERROR `break` inside `gen` block
let _ = async gen { break; }; //~ ERROR `break` inside `async gen` block
}