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

Emit a warning on generic parameters with doc comments #91397

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Nov 30, 2021

Fixes #90610

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-attributes Area: Attributes (`#[…]`, `#![…]`) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 30, 2021
@rust-highfive
Copy link
Collaborator

r? @wesleywiser

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 30, 2021
@wesleywiser
Copy link
Member

Thanks @jyn514!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 30, 2021

📌 Commit bd894a0 has been approved by wesleywiser

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 30, 2021
Comment on lines +29 to +30
fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
//~^ ERROR: unused doc comment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's also worth adding tests for

fn doc_comment_on_generic<
    /// x
    T>(val: T) {}
//~^^ ERROR: unused doc comment

and

fn doc_comment_on_generic</** foo */ T>(val: T) {}
//~^ ERROR: unused doc comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, GitHub didn't show me that this was already approved.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to test those, anyway - rustc represents them both as #[doc] under the hood. There are plenty of other tests that would fail if that weren't the case.

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 1, 2021
…askrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#91294 (Visit type in process_projection_elem.)
 - rust-lang#91340 (Bump compiler_builtins to 0.1.55 to bring in fixes for targets lackin…)
 - rust-lang#91366 (Only show notable traits if both types are the same)
 - rust-lang#91397 (Emit a warning on generic parameters with doc comments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7baafb1 into rust-lang:master Dec 1, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 1, 2021
@jyn514 jyn514 deleted the generic-param-docs branch December 1, 2021 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rustc doesn't emit unused_doc_comments warning for documentation on generic parameters
6 participants