Fix help on AmbiguousMissingKwForItemSub diagnostic
This commit is contained in:
parent
8aa0e905f4
commit
d14c26f45a
3 changed files with 9 additions and 5 deletions
|
|
@ -2266,7 +2266,9 @@ pub(crate) enum AmbiguousMissingKwForItemSub {
|
|||
span: Span,
|
||||
snippet: String,
|
||||
},
|
||||
#[help("you likely meant to define an item, e.g., `{$vis} fn foo() {\"{}\"}`")]
|
||||
#[help(
|
||||
"if you meant to call a macro, remove the `pub` and add a trailing `!` after the identifier"
|
||||
)]
|
||||
HelpMacro,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ curly__rhs_dollar__no_round !(a);
|
|||
macro_rules! no_curly__no_rhs_dollar__round {
|
||||
( $( $i:ident ),* ) => { count(i) };
|
||||
//~^ ERROR missing `fn` or `struct` for function or struct definition
|
||||
//~| HELP if you meant to call a macro, try
|
||||
}
|
||||
no_curly__no_rhs_dollar__round !(a, b, c);
|
||||
|
||||
|
|
@ -34,6 +35,7 @@ no_curly__no_rhs_dollar__round !(a, b, c);
|
|||
macro_rules! no_curly__no_rhs_dollar__no_round {
|
||||
( $i:ident ) => { count(i) };
|
||||
//~^ ERROR missing `fn` or `struct` for function or struct definition
|
||||
//~| HELP if you meant to call a macro, try
|
||||
}
|
||||
no_curly__no_rhs_dollar__no_round !(a);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ LL | ( $( $i:ident ),* ) => { count!(i) };
|
|||
| +
|
||||
|
||||
error: missing `fn` or `struct` for function or struct definition
|
||||
--> $DIR/usage-errors.rs:35:23
|
||||
--> $DIR/usage-errors.rs:36:23
|
||||
|
|
||||
LL | ( $i:ident ) => { count(i) };
|
||||
| ^^^^^
|
||||
|
|
@ -41,13 +41,13 @@ LL | ( $i:ident ) => { count!(i) };
|
|||
| +
|
||||
|
||||
error: variable `i` is still repeating at this depth
|
||||
--> $DIR/usage-errors.rs:42:36
|
||||
--> $DIR/usage-errors.rs:44:36
|
||||
|
|
||||
LL | ( $( $i:ident ),* ) => { count($i) };
|
||||
| ^^
|
||||
|
||||
error[E0425]: cannot find value `a` in this scope
|
||||
--> $DIR/usage-errors.rs:52:49
|
||||
--> $DIR/usage-errors.rs:54:49
|
||||
|
|
||||
LL | ( $i:ident ) => { count($i) };
|
||||
| -- due to this macro variable
|
||||
|
|
@ -56,7 +56,7 @@ LL | const _: u32 = no_curly__rhs_dollar__no_round! (a);
|
|||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find function `count` in this scope
|
||||
--> $DIR/usage-errors.rs:49:23
|
||||
--> $DIR/usage-errors.rs:51:23
|
||||
|
|
||||
LL | ( $i:ident ) => { count($i) };
|
||||
| ^^^^^ not found in this scope
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue