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

rustdoc: Simplify modifications of effective visibility table #103010

Merged
merged 3 commits into from
Oct 30, 2022

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Oct 13, 2022

It is now obvious that rustdoc only calls set_access_level with foreign def ids and AccessLevel::Public.

The second commit makes one more step and separates effective visibilities coming from rustc from similar data collected by rustdoc for extern DefIds.
The original table is no longer modified and now only contains local def ids as populated by rustc.

cc #102026 @Bryanskiy

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 13, 2022
@rust-highfive
Copy link
Collaborator

r? @CraftSpider

(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 Oct 13, 2022
// All items need to be handled here in case someone wishes to link
// to them with intra-doc links
self.cx.cache.access_levels.set_access_level(did, AccessLevel::Public);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Behavior change 1: set_access_level is now called on DefKind::Mod items themselves too.
It was previously done in visit_lib.rs but not here.

self.access_levels.set_access_level(did, level.unwrap());
level
} else {
old_level
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possible behavior change 2: the visitor can no longer recurse into doc-hidden modules.
It was previously the case in visit_ast.rs but not here.

@rust-log-analyzer

This comment was marked as resolved.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2022
@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 14, 2022
@bors

This comment was marked as resolved.

@petrochenkov
Copy link
Contributor Author

I made one more step and separated effective visibilities ("access levels") coming from rustc from similar data collected by rustdoc for extern DefIds.
The original table is no longer modified and now only contains local def ids as populated by rustc.

@bors

This comment was marked as resolved.

@petrochenkov
Copy link
Contributor Author

Ping @CraftSpider @GuillaumeGomez
This PR is a pre-requisite for other work, including #94857.

@GuillaumeGomez
Copy link
Member

Looks good to me, thanks! Let's run a perf check to ensure it doesn't have an impact then let's r+.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

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

bors commented Oct 29, 2022

⌛ Trying commit a5ea013436b3f11d263e1c5e3dc2383de2bc68c6 with merge 5e44172c9c9d88b400c5755c5caf906c9b8188f6...

@bors
Copy link
Contributor

bors commented Oct 29, 2022

☀️ Try build successful - checks-actions
Build commit: 5e44172c9c9d88b400c5755c5caf906c9b8188f6 (5e44172c9c9d88b400c5755c5caf906c9b8188f6)

@rust-timer
Copy link
Collaborator

Queued 5e44172c9c9d88b400c5755c5caf906c9b8188f6 with parent 33b530e, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5e44172c9c9d88b400c5755c5caf906c9b8188f6): comparison URL.

Overall result: ✅ improvements - 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 is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-1.1%, -0.3%] 21
Improvements ✅
(secondary)
-1.0% [-1.3%, -0.3%] 19
All ❌✅ (primary) -0.5% [-1.1%, 0.3%] 22

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.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
-3.3% [-3.7%, -3.0%] 2
All ❌✅ (primary) -3.4% [-3.4%, -3.4%] 1

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 Oct 29, 2022
@GuillaumeGomez
Copy link
Member

Even if small, it does impact (positively) performance, nice!

@bors r+ rollup=iffy

@bors
Copy link
Contributor

bors commented Oct 29, 2022

📌 Commit a5ea013436b3f11d263e1c5e3dc2383de2bc68c6 has been approved by GuillaumeGomez

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 Oct 29, 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 Oct 29, 2022
@bors

This comment was marked as resolved.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 29, 2022
@petrochenkov
Copy link
Contributor Author

@bors r=GuillaumeGomez

@bors
Copy link
Contributor

bors commented Oct 29, 2022

📌 Commit f1850d4 has been approved by GuillaumeGomez

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 29, 2022
@bors
Copy link
Contributor

bors commented Oct 30, 2022

⌛ Testing commit f1850d4 with merge fab0432...

@bors
Copy link
Contributor

bors commented Oct 30, 2022

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing fab0432 to master...

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

Finished benchmarking commit (fab0432): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
-0.6% [-1.3%, -0.3%] 21
Improvements ✅
(secondary)
-1.1% [-1.5%, -0.3%] 21
All ❌✅ (primary) -0.6% [-1.3%, -0.3%] 21

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.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
-3.6% [-3.6%, -3.6%] 1
Improvements ✅
(secondary)
-3.4% [-3.8%, -3.2%] 3
All ❌✅ (primary) -3.6% [-3.6%, -3.6%] 1

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)
-2.2% [-2.2%, -2.2%] 3
All ❌✅ (primary) - - 0

Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…omez

rustdoc: Simplify modifications of effective visibility table

It is now obvious that rustdoc only calls `set_access_level` with foreign def ids and `AccessLevel::Public`.

The second commit makes one more step and separates effective visibilities coming from rustc from similar data collected by rustdoc for extern `DefId`s.
The original table is no longer modified and now only contains local def ids as populated by rustc.

cc rust-lang#102026 `@Bryanskiy`
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