Skip to content

Separate private_intra_doc_links and broken_intra_doc_links into separate lints - #77249

Merged
bors merged 2 commits into
rust-lang:masterfrom
jyn514:private-links
Sep 27, 2020
Merged

Separate private_intra_doc_links and broken_intra_doc_links into separate lints#77249
bors merged 2 commits into
rust-lang:masterfrom
jyn514:private-links

Conversation

@jyn514

Copy link
Copy Markdown
Member

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))

@jyn514jyn514 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-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 27, 2020
@jyn514jyn514 added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Sep 27, 2020
@jyn514
jyn514force-pushed the private-links branch 2 times, most recently from 3f20adb to 3fdad10CompareSeptember 27, 2020 04:10
Comment threadcompiler/rustc_session/src/lint/builtin.rs Outdated
…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
Copy Markdown
Member

@bors r+

@bors

bors commented Sep 27, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 51aab59d93778d4afd5dbe01b8e901a2847b092c has been approved by Manishearth

@borsbors 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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

@bors r=Manishearth

@bors

bors commented Sep 27, 2020

Copy link
Copy Markdown
Collaborator

📌 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:masterSep 27, 2020
@rustbotrustbot 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
Copy Markdown

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

@jyn514

Copy link
Copy Markdown
MemberAuthor
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant 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

@jyn514@rust-highfive@Manishearth@bors@tiziano88@rustbot