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

Document built-in syntax extensions #5605

Closed
brson opened this issue Mar 28, 2013 · 4 comments · Fixed by #13255
Closed

Document built-in syntax extensions #5605

brson opened this issue Mar 28, 2013 · 4 comments · Fixed by #13255
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@brson
Copy link
Contributor

brson commented Mar 28, 2013

core::unstable::extfmt has some good documentation about fmt! but this module is an implementation detail and isn't (or shouldn't be) shown in the docs. Maybe rustdoc could have a way to write arbitrary pages of documentation and we could have one for syntax extensions and macros. Once syntax extensions become user-definable then we could create a more general way of documenting them.

@Kimundi
Copy link
Member

Kimundi commented Mar 28, 2013

Right, would be nice if macros and syntax extensions would behave more like normal items in that regard. Proposals:

  • allow doc attributes on macro-rules! invokations
  • rustdoc would then use those to generate docs for macros
  • a way to expand/hide item-macros in the docs, so that you can see what those define
  • as a temporary way to add documentation: doccomments on a fake_item!(name) item-macro using the same mechanic as the macro-rules one above

@graydon
Copy link
Contributor

graydon commented Jun 20, 2013

For macros I think @Kimundi has the right idea(s). For compiled syntax extensions, I suspect rustdoc should be taught to declaratively associate a syntax extension name with the module defining it. Possibly this could be an additional attribute on the module containing the extension, possibly part of the hypothetical loadable-syntax-extension-defining form, like a #[define_syntax_extension(fmt)]; to go along with a hypothetical #[use_syntax_extension(fmt=libsyntax_fmt)]; or such (as sketched in #6735) ?

@msullivan
Copy link
Contributor

Nothing new to report.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Oct 9, 2013
It's unclear to me why these currently aren't allowed, and my best guess is that
a long time ago we didn't strip the ast of cfg nodes before syntax expansion.
Now that this is done, I'm not certain that we should continue to prohibit this
functionality.

This is a step in the right direction towards rust-lang#5605, because now we can add an
empty `std::macros` module to the documentation with a bunch of empty macros
explaining how they're supposed to be used.
bors added a commit that referenced this issue Oct 9, 2013
It's unclear to me why these currently aren't allowed, and my best guess is that
a long time ago we didn't strip the ast of cfg nodes before syntax expansion.
Now that this is done, I'm not certain that we should continue to prohibit this
functionality.

This is a step in the right direction towards #5605, because now we can add an
empty `std::macros` module to the documentation with a bunch of empty macros
explaining how they're supposed to be used.
alexcrichton added a commit to alexcrichton/rust that referenced this issue Feb 19, 2014
Any macro tagged with #[macro_export] will be showed in the documentation for
that module. This also documents all the existing macros inside of std::macros.

Closes rust-lang#3163
cc rust-lang#5605
Closes rust-lang#9954
@flaper87
Copy link
Contributor

flaper87 commented Mar 3, 2014

Visiting for triage. Attributes are now allowed in macros and macros tagged with #[macro_export] will be showed in the documentation.

Still some work left here, though.

bors added a commit that referenced this issue Apr 4, 2014
These syntax extensions need a place to be documented, and this starts passing a
`--cfg dox` parameter to `rustdoc` when building and testing documentation in
order to document macros so that they have no effect on the compiled crate, but
only documentation.

Closes #5605
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants