rust/tests/ui/parser/break-in-unlabeled-block-in-macro.rs

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

44 lines
869 B
Rust
Raw Normal View History

2023-10-09 22:48:10 +00:00
macro_rules! foo {
() => {
break (); //~ ERROR `break` outside of a loop or labeled block
};
($e: expr) => {
break $e; //~ ERROR `break` outside of a loop or labeled block
};
(stmt $s: stmt) => {
$s
};
(@ $e: expr) => {
{ break $e; } //~ ERROR `break` outside of a loop or labeled block
};
(=> $s: stmt) => {
{ $s }
};
}
fn main() {
{
foo!();
}
{
foo!(());
}
{
foo!(stmt break ()); //~ ERROR `break` outside of a loop or labeled block
}
{
foo!(@ ());
}
{
foo!(=> break ()); //~ ERROR `break` outside of a loop or labeled block
}
{
macro_rules! bar {
() => {
break () //~ ERROR `break` outside of a loop or labeled block
};
}
bar!()
}
}