-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Commenting a macro branch:
macro_rules! something {
/// This macro branch expands to nottin'
() => { }
}
... throws an error:
error: no rules expected the token `[`
--> src/lib.rs:...:...
|
| /// This macro branch expands to nottin'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
Now, this error message makes sense if you think of ///
as a shorthand for #[doc = "..."]
, but imho it'd be better to print something in terms of:
error: macro branches can't have outer-line documentation
--> src/lib.rs:...:...
|
| /// This macro branch expands to nottin'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `///` is an outer-line documentation
hint: either move the comment before the macro:
/// This macro branch expands to nottin'
macro_rules! something {
() => { }
}
hint: ... or replace `///` with `//`:
macro_rules! something {
// This macro branch expands to nottin'
() => { }
}
fmease, compiler-errors, Aaron1011, TaKO8Ki and Kobzol
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.