Skip to content
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

Rust grammar: Doc comments in Rust are actually not comments, therefore shouldn't be marked as such #20

Open
alexr00 opened this issue Jun 7, 2021 · 0 comments

Comments

@alexr00
Copy link

alexr00 commented Jun 7, 2021

From @KSXGitHub

Comments are pieces of code that is usually ignored and can be placed anywhere. Doc comments in most languages are usually ignored by the compiler/interpreter. But Rust's so-called "doc comments" are different from normal comments:

  • Under every outer doc (/// ..., /** ... */, or #[doc = "..."]) must be a language item. Otherwise, it is a syntax error.
  • Every inner doc (//! ..., /*! ... */, or #![doc = "..."]) must be placed within a language item. Otherwise, it is a syntax error.
  • Doc comment is just syntactic sugar for the #[doc] attribute.

Suggestion

Doc comment in Rust is a flavor of Markdown, therefore it should be highlighted as a Markdown code snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant