Skip to content

Consolidate rustdoc's lint passes into a single pass #104757

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

Merged
merged 1 commit into from
Dec 4, 2022

Conversation

camelid
Copy link
Member

@camelid camelid commented Nov 23, 2022

This should improve performance and simplify the code.

r? @GuillaumeGomez

@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 Nov 23, 2022
@camelid
Copy link
Member Author

camelid commented Nov 23, 2022

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 23, 2022
@bors
Copy link
Collaborator

bors commented Nov 23, 2022

⌛ Trying commit 03dde7c3ac40ea6d2c1623c4d097e08166afc1b6 with merge ac8e12e0ba51bd025e996f86849e13b836d475bf...

This should improve performance and simplify the code.
@camelid
Copy link
Member Author

camelid commented Nov 23, 2022

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Nov 23, 2022

⌛ Trying commit 9eb8577 with merge 797475cf006080799e493a05d64b5bc60992c461...

@bors
Copy link
Collaborator

bors commented Nov 23, 2022

☀️ Try build successful - checks-actions
Build commit: 797475cf006080799e493a05d64b5bc60992c461 (797475cf006080799e493a05d64b5bc60992c461)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (797475cf006080799e493a05d64b5bc60992c461): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-3.0%, -3.0%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 23, 2022
@GuillaumeGomez
Copy link
Member

The performance shouldn't be impacted (as confirmed just above) but the code simplification is still nice to have. Considering it's changing some rustdoc cli flags, let's double check with the rest of the team first. cc @rust-lang/rustdoc

@Manishearth
Copy link
Member

Yes, lint passes are run stacked on each other, having multiple or single lint passes ought not to change performance

fn visit_item(&mut self, item: &Item) {
bare_urls::visit_item(self.cx, item);
check_code_block_syntax::visit_item(self.cx, item);
html_tags::visit_item(self.cx, item);
Copy link
Member

Choose a reason for hiding this comment

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

All of these start by computing the collapsed_doc_value, it might save time to compute that once here and pass in an Option<&str> for it.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think that's one way to unify passes: unify everything that needs the doc value

@camelid
Copy link
Member Author

camelid commented Nov 23, 2022

Yes, lint passes are run stacked on each other, having multiple or single lint passes ought not to change performance

Interesting, I didn't know that! Where in the code does that happen?

@Manishearth
Copy link
Member

Somewhere in librustc_lint

Basically the lint passes are run as a single Visitor, which then runs through a list of the relevant check_ function for each lint when it hits each node.

@camelid
Copy link
Member Author

camelid commented Nov 23, 2022

Hmm, but these lint passes are defined in rustdoc::passes. In other words, they're of type rustdoc::passes::Pass, like collect_intra_doc_links. I don't think librustc_lint runs them?

@Manishearth
Copy link
Member

Oh, they operate on clean::Crate. hmmm.

That would have been a bit concerning to me because the LintPass architecture handles lint levels (or, it used to) but turns out if you emit lints directly from the tcx it handles levels for you.

Makes sense, in that case.

We probably can make them get run the same way, though.

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

IMO we should switch these from using clean::Crate to tcx directly at some point, but this seems like a step in the right direction.

@camelid
Copy link
Member Author

camelid commented Dec 3, 2022

@bors r=GuillaumeGomez,jyn514,Manishearth

@bors
Copy link
Collaborator

bors commented Dec 3, 2022

📌 Commit 9eb8577 has been approved by GuillaumeGomez,jyn514,Manishearth

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 3, 2022
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 3, 2022
@bors
Copy link
Collaborator

bors commented Dec 4, 2022

⌛ Testing commit 9eb8577 with merge 1195b67...

@bors
Copy link
Collaborator

bors commented Dec 4, 2022

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez,jyn514,Manishearth
Pushing 1195b67 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 4, 2022
@bors bors merged commit 1195b67 into rust-lang:master Dec 4, 2022
@rustbot rustbot added this to the 1.67.0 milestone Dec 4, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1195b67): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) - - 0

@camelid camelid deleted the consolidate-lints branch December 5, 2022 21:31
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…meGomez,jyn514,Manishearth

Consolidate rustdoc's lint passes into a single pass

This should improve performance and simplify the code.

r? `@GuillaumeGomez`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants