mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
44 lines
869 B
Rust
44 lines
869 B
Rust
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!()
|
|
}
|
|
}
|