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

pass unused_extern_crates in librustdoc::doctest::make_test #110798

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

onur-ozkan
Copy link
Member

blocker for #106621

@rustbot
Copy link
Collaborator

rustbot commented Apr 25, 2023

r? @GuillaumeGomez

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 25, 2023
src/librustdoc/doctest.rs Outdated Show resolved Hide resolved
@Noratrieb
Copy link
Member

Can you add the reasoning behind allowing this in the comment? It doesn't explain why rustdoc should do this.

@rust-log-analyzer

This comment has been minimized.

@onur-ozkan
Copy link
Member Author

Can you add the reasoning behind allowing this in the comment? It doesn't explain why rustdoc should do this.

This is needed for using unused_extern_crates on compiler docs.

ref err: https://github.com/rust-lang/rust/actions/runs/4797403514/jobs/8534349146?pr=106621#step:26:3011

will extend the comment, I guess it's not clear enough.

@Noratrieb
Copy link
Member

It still doesn't include reasoning why rustdoc should pass this by default. Why is not allowing it a problem?

@onur-ozkan
Copy link
Member Author

It still doesn't include reasoning why rustdoc should pass this by default. Why is not allowing it a problem?

We want to add rust_2018_idioms lint group to the doctests.

Because of this line https://github.com/rust-lang/rust/blob/ca118d4f3e1366dee7a51a3177a2e82d9007f0a8/src/librustdoc/doctest.rs#L686

adds lines like extern crate r#rustc_graphviz; to the compiler tree, we are getting errors on doctests by the rust_2018_idioms group. Since it's automagically added, couldn't find any better way to overcome it.

@Noratrieb
Copy link
Member

"rustdoc implicitly inserts an extern crate item for the own crate which may be unused, so we need to allow the lint"
Something like that would make a good comment to add

Signed-off-by: ozkanonur <work@onurozkan.dev>
@jyn514
Copy link
Member

jyn514 commented Apr 26, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 26, 2023

📌 Commit f56b6d0 has been approved by jyn514

It is now in the queue for this repository.

@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 Apr 26, 2023
@jyn514 jyn514 added A-edition-2018-lints Area: Lints supporting the 2018 edition A-doctests Area: Documentation tests, run by rustdoc labels Apr 26, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 26, 2023
…ates, r=jyn514

pass `unused_extern_crates` in `librustdoc::doctest::make_test`

blocker for rust-lang#106621
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2023
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#108760 (Add lint to deny diagnostics composed of static strings)
 - rust-lang#109444 (Change tidy error message for TODOs)
 - rust-lang#110419 (Spelling library)
 - rust-lang#110550 (Suggest deref on comparison binop RHS even if type is not Copy)
 - rust-lang#110641 (Add new rustdoc book chapter to describe in-doc settings)
 - rust-lang#110798 (pass `unused_extern_crates` in `librustdoc::doctest::make_test`)
 - rust-lang#110819 (simplify TrustedLen impls)
 - rust-lang#110825 (diagnostics: add test case for already-solved issue)
 - rust-lang#110835 (Make some region folders a little stricter.)
 - rust-lang#110847 (rustdoc-json: Time serialization.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1d73549 into rust-lang:master Apr 26, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 26, 2023
@onur-ozkan onur-ozkan deleted the rustdoc-unused-extern-crates branch April 26, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc A-edition-2018-lints Area: Lints supporting the 2018 edition 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.

7 participants