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

Separate private_intra_doc_links and broken_intra_doc_links into separate lints #77249

Merged
merged 2 commits into from
Sep 27, 2020

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Sep 27, 2020

This is not ideal because it means deny(broken_intra_doc_links) will
no longer deny(private_intra_doc_links). However, it can't be fixed
with a new lint group, because broken is already in the rustdoc lint
group; there would need to be a way to nest groups somehow.

This also removes the early return so that the link will be generated
even though it gives a warning.

r? @Manishearth
cc @ecstatic-morse (#77242 (comment))

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-visibility Area: Visibility / privacy A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Sep 27, 2020
@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 27, 2020
@jyn514 jyn514 added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label Sep 27, 2020
@jyn514 jyn514 force-pushed the private-links branch 2 times, most recently from 3f20adb to 3fdad10 Compare September 27, 2020 04:10
compiler/rustc_session/src/lint/builtin.rs Outdated Show resolved Hide resolved
…separate lints

This is not ideal because it means `deny(broken_intra_doc_links)` will
no longer `deny(private_intra_doc_links)`. However, it can't be fixed
with a new lint group, because `broken` is already in the `rustdoc` lint
group; there would need to be a way to nest groups somehow.

This also removes the early `return` so that the link will be generated
even though it gives a warning.
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 27, 2020

📌 Commit 51aab59d93778d4afd5dbe01b8e901a2847b092c has been approved by Manishearth

@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 Sep 27, 2020
@jyn514
Copy link
Member Author

jyn514 commented Sep 27, 2020

Oh lol it tried to run the example as a doc-test.

 ---- /checkout/src/doc/rustdoc/src/lints.md - Lints::private_intra_doc_links (line 92) stdout ----
error: unknown start of token: `
 --> /checkout/src/doc/rustdoc/src/lints.md:93:35
  |
3 | warning: public documentation for `public` links to private item `private`
  |                                   ^
  |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
  |
3 | warning: public documentation for 'public` links to private item `private`
  |                                   ^

Let me try ignoring it.

@jyn514
Copy link
Member Author

jyn514 commented Sep 27, 2020

@bors r=Manishearth

@bors
Copy link
Contributor

bors commented Sep 27, 2020

📌 Commit 80ffaed has been approved by Manishearth

This was referenced Sep 27, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2020
…as-schievink

Rollup of 7 pull requests

Successful merges:

 - rust-lang#76839 (Add asm! support for MIPS)
 - rust-lang#77203 (Check for missing const-stability attributes in `rustc_passes`)
 - rust-lang#77249 (Separate `private_intra_doc_links` and `broken_intra_doc_links` into separate lints)
 - rust-lang#77252 (reduce overlong line)
 - rust-lang#77256 (Fix typo in ExpnData documentation)
 - rust-lang#77262 (Remove duplicate comment)
 - rust-lang#77263 (Clean up trivial if let)

Failed merges:

r? `@ghost`
@bors bors merged commit 2a90d31 into rust-lang:master Sep 27, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 27, 2020
@jyn514 jyn514 deleted the private-links branch September 27, 2020 19:38
@tiziano88
Copy link

It seems it is not possible to #![allow(private_intra_doc_links)] now, is this intended? How to disable this warning?

@jyn514
Copy link
Member Author

jyn514 commented Oct 19, 2020

warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`

Well that's odd.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 6, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? `@Manishearth`

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? ``@Manishearth``

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? ```@Manishearth```

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? ````@Manishearth````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? `````@Manishearth`````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 8, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? ``````@Manishearth``````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 8, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? ```````@Manishearth```````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 9, 2020
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in rust-lang#77249 (comment).

r? ````````@Manishearth````````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-visibility Area: Visibility / privacy S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants