Closed
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'
() => { }
}