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

RFC: Statically enforce that only one type of doc comment is present on any given item #6781

Closed
bstrie opened this issue May 28, 2013 · 7 comments

Comments

@bstrie
Copy link
Contributor

bstrie commented May 28, 2013

This is an abomination, yet totally legal:

/**
 * foo
 */

/// bar

#[doc="spam"]
mod m {
  #[doc="eggs"];

  //! baz

  /*! qux */
}

fn main() {}

Putting aside the fact that we just have waay too many forms of doc comments, this should be a compile-time error. I can think of no scenario where you'd want to split an item's documentation up among several comments, let alone several different types of comments.

@novabyte
Copy link

Agreed. For what it's worth my favorite comment form for Rust code is:

#[doc="""
My documentation is great. :)
"""]
mod m {
}

@bstrie
Copy link
Contributor Author

bstrie commented May 28, 2013

See also #6782, in the case where we decide to have more than one type of doc comment form.

@ben0x539
Copy link
Contributor

I can think of no scenario where you'd want to split an item's documentation up among several comments, [...]

I tend to agree, but note that right now multiple lines of /// comments end up as separate attributes in the ast. So that'd need to change to ban multiple doc comments (unless we remove the //////! forms).

@bstrie
Copy link
Contributor Author

bstrie commented May 28, 2013

See also PR #6757.

@emberian
Copy link
Member

I agree that this should be deny-linted by default.

@huonw
Copy link
Member

huonw commented Nov 10, 2013

Triage: no change.

@flaper87
Copy link
Contributor

This needs to go through the new RFC process. https://github.com/rust-lang/rfcs/

flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 25, 2021
…krgr

lintcheck fix build (forgot to pass function parameter) and runtime (…

…don't check metadata of directory if it does not exist)

Accidentally broke lintcheck in my previous commit.

changelog: None
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

6 participants