File tree Expand file tree Collapse file tree
tests/ui/macros/metavar-expressions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2266,7 +2266,9 @@ pub(crate) enum AmbiguousMissingKwForItemSub {
22662266 span : Span ,
22672267 snippet : String ,
22682268 } ,
2269- #[ help( "you likely meant to define an item, e.g., `{$vis} fn foo() {\" {}\" }`" ) ]
2269+ #[ help(
2270+ "if you meant to call a macro, remove the `pub` and add a trailing `!` after the identifier"
2271+ ) ]
22702272 HelpMacro ,
22712273}
22722274
Original file line number Diff line number Diff line change @@ -27,13 +27,15 @@ curly__rhs_dollar__no_round !(a);
2727macro_rules! no_curly__no_rhs_dollar__round {
2828 ( $( $i: ident ) ,* ) => { count( i) } ;
2929 //~^ ERROR missing `fn` or `struct` for function or struct definition
30+ //~| HELP if you meant to call a macro, try
3031}
3132no_curly__no_rhs_dollar__round ! ( a, b, c) ;
3233
3334#[ rustfmt:: skip] // autoformatters can break a few of the error traces
3435macro_rules! no_curly__no_rhs_dollar__no_round {
3536 ( $i: ident ) => { count( i) } ;
3637 //~^ ERROR missing `fn` or `struct` for function or struct definition
38+ //~| HELP if you meant to call a macro, try
3739}
3840no_curly__no_rhs_dollar__no_round ! ( a) ;
3941
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ LL | ( $( $i:ident ),* ) => { count!(i) };
2626 | +
2727
2828error: missing `fn` or `struct` for function or struct definition
29- --> $DIR/usage-errors.rs:35 :23
29+ --> $DIR/usage-errors.rs:36 :23
3030 |
3131LL | ( $i:ident ) => { count(i) };
3232 | ^^^^^
@@ -41,13 +41,13 @@ LL | ( $i:ident ) => { count!(i) };
4141 | +
4242
4343error: variable `i` is still repeating at this depth
44- --> $DIR/usage-errors.rs:42 :36
44+ --> $DIR/usage-errors.rs:44 :36
4545 |
4646LL | ( $( $i:ident ),* ) => { count($i) };
4747 | ^^
4848
4949error[E0425]: cannot find value `a` in this scope
50- --> $DIR/usage-errors.rs:52 :49
50+ --> $DIR/usage-errors.rs:54 :49
5151 |
5252LL | ( $i:ident ) => { count($i) };
5353 | -- due to this macro variable
@@ -56,7 +56,7 @@ LL | const _: u32 = no_curly__rhs_dollar__no_round! (a);
5656 | ^ not found in this scope
5757
5858error[E0425]: cannot find function `count` in this scope
59- --> $DIR/usage-errors.rs:49 :23
59+ --> $DIR/usage-errors.rs:51 :23
6060 |
6161LL | ( $i:ident ) => { count($i) };
6262 | ^^^^^ not found in this scope
You can’t perform that action at this time.
0 commit comments