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

rustdoc: consecutive single-line docstrings should be concatenated #3780

Closed
ghost opened this issue Oct 16, 2012 · 7 comments
Closed

rustdoc: consecutive single-line docstrings should be concatenated #3780

ghost opened this issue Oct 16, 2012 · 7 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@ghost
Copy link

ghost commented Oct 16, 2012

If document strings for rustdoc are written as a sequence of single line comments (i.e. ///) then rustdoc only uses the first line. The whole sequence should be joined to form a single attribute for further processing.

@Dretch
Copy link
Contributor

Dretch commented Oct 19, 2012

I would be happy to have a look at this (I guess maybe I caused the issue).

@Dretch
Copy link
Contributor

Dretch commented Oct 21, 2012

It seems like one way to fix this issue would be to have rustdoc concatenate all doc-attributes/doc-comments for an item and use the concatenated text as if it were from a single doc-attribute/comment.

Currently rustdoc discards all but the first doc-attribute, and emits a warning that the others were discarded. However the warning is emitted using warn!(...) which means it doesn't actually display to the user unless they have turned on warn logging for rustdoc, which seems unlikely.

Would this approach (concatenating all doc-comments) be ok?

@Dretch
Copy link
Contributor

Dretch commented Oct 21, 2012

Another approach would be to change the lexer so that it parses multiple adjacent lines that all start with /// as a single doc-comment.

@brson
Copy link
Contributor

brson commented Oct 21, 2012

@Dretch Having rustdoc concatenate the attributes sounds good to me.

@ghost
Copy link
Author

ghost commented Oct 22, 2012

@Dretch You're right, I ran rustdoc without warnings being logged.
Are you referring to fn doc_meta in attr_parser.rs? That looks like it would be a sensible place to do the concatenation.

Dretch added a commit to Dretch/rust that referenced this issue Oct 22, 2012
@Dretch
Copy link
Contributor

Dretch commented Oct 22, 2012

@peterhull90

Are you referring to fn doc_meta in attr_parser.rs? That looks like it would be a sensible place to do the concatenation.

Yup. See the pull request - it makes multi-line /// comments work the same as /** ... */ comments (as a side effect of concatenating all kinds of doc-comment).

Unfortunately multi-line comments seem a bit broken in general with rustdoc. In html output mode they are concatenated into a single line (I think due to some weirdness with pandoc).

brson added a commit that referenced this issue Oct 22, 2012
@brson
Copy link
Contributor

brson commented Oct 22, 2012

Fixed by @Dretch

@brson brson closed this as completed Oct 22, 2012
flip1995 pushed a commit to flip1995/rust that referenced this issue May 5, 2020
… r=flip1995

Fix FP on while-let-on-iterator

- fix `is_refutable` for slice patterns
- fix `is_refutable` for bindings
- add some TODO-s for cases, which can not be fixed easily

fixes rust-lang#3780

changelog: fix FP on while-let-on-iterator for arrays and bindings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants