Skip to content

Filter doc comments from macro input #18076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Binero opened this issue Oct 15, 2014 · 3 comments
Closed

Filter doc comments from macro input #18076

Binero opened this issue Oct 15, 2014 · 3 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

Comments

@Binero
Copy link
Contributor

Binero commented Oct 15, 2014

This seems to be a very inconsistant issue, but I think it's related to macros.

Here's an example of a list of comments that don't get parsed properly:

bitflags! {
    flags Tests: Test {
        /// Test
        static TestA = 0x80,
        // TODO: Document this.
        static TestB          = 0x40
    }
}

This code will error saying "no rules expected the token /// Test".
http://is.gd/Zkpgvd

@lifthrasiir
Copy link
Contributor

That's mainly because /// foo is a separate token equivalent to #[doc="foo"] unlike comments (no token sent to the macro). Not sure if bitflags! can account for this, but it still highlights the limitation of the current macro parser.

@kmcallister kmcallister changed the title Comments Breaking Filter doc comments from macro input Oct 16, 2014
@kmcallister kmcallister added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Oct 16, 2014
@pczarn
Copy link
Contributor

pczarn commented Oct 18, 2014

Possibly at odds with or duplicate of #14197
To be fixed in #17830

@lifthrasiir Perhaps the macro parser shouldn't be burdened with such details. #17830 starts expanding the DOC_COMMENT token into the equivalent sequence in tokentree reader.

@steveklabnik
Copy link
Member

#17830 was merged, so I think this has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

No branches or pull requests

5 participants