wickerman icon indicating copy to clipboard operation
wickerman copied to clipboard

Errors not generated when applied to non-struct item with doc-comments

Open zmitchell opened this issue 7 years ago • 2 comments

If you apply the #[wickerman] attribute to an item that is not a struct, you should see an error:

#[wickerman]
enum Foo { // error: this is not a struct
    Bar,
    Baz,
}

However, if that item has doc-comments, you won't see the error:

/// This doesn't generate an error
#[wickerman]
enum Foo {
    Bar,
    Baz,
}

zmitchell avatar Feb 06 '18 00:02 zmitchell

I don't think this is a wickerman bug. Should be fixed by https://github.com/rust-lang/rust/issues/47941.

dtolnay avatar Feb 06 '18 00:02 dtolnay

I agree, when I add an enum to the existing example:

/// This is a doc-comment
#[wickerman]
enum SpamOrEggs {
    Spam,
    Eggs,
}

I get this error message:

error: This is not a struct
 --> <macro expansion>:1:1
  |
1 | /// This is a doc-comment
  | ^^^^^^^^^^^^^^^^^^^^^^^^^

which has the wrong filename and line number, just like Sean pointed out.

zmitchell avatar Feb 06 '18 00:02 zmitchell