rustc: Replace HirIds with LocalDefIds in AccessLevels tables#87568
rustc: Replace HirIds with LocalDefIds in AccessLevels tables#87568bors merged 2 commits intorust-lang:masterfrom
HirIds with LocalDefIds in AccessLevels tables#87568Conversation
|
Some changes occurred in intra-doc-links. cc @jyn514 |
compiler/rustc_privacy/src/lib.rs
Outdated
There was a problem hiding this comment.
The logic in this function was slightly changed to walk DefId parents instead of HirId parents, but the end result should be the same, I think.
There was a problem hiding this comment.
IIUC, this loop is only accessed when macro_module_def_id point to a module that can be named from the outside. As a consequence, all its parents are modules. This is relied upon by update_macro_reachable. All modules are HIR owners, so walking parents by def_key or through HIR is equivalent.
Do you agree with the explanation? Should there be a comment?
Can the loop be simplified using tcx.hir().parent_owner_iter()?
There was a problem hiding this comment.
Added a comment.
parent_owner_iter doesn't seem to make things simpler because it requires converting to HirIds and back.
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit 901e8567836f70407d55e924ecae35c822743b76 with merge 258b818d64e93a02410b9a5a79c00e11788dfdf6... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit b639c36b9dad866d247c53f0053cb2105c84f27c with merge 0b23956c3baae739f7b14e136e301972fff31032... |
|
☀️ Try build successful - checks-actions |
|
Queued 0b23956c3baae739f7b14e136e301972fff31032 with parent b708886, future comparison URL. |
|
Finished benchmarking try commit (0b23956c3baae739f7b14e136e301972fff31032): comparison url. Summary: This benchmark run did not return any significant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. @bors rollup=never |
|
@bors rollup=maybe |
cjgillot
left a comment
There was a problem hiding this comment.
LGTM. I left a few questions.
compiler/rustc_privacy/src/lib.rs
Outdated
There was a problem hiding this comment.
IIUC, this loop is only accessed when macro_module_def_id point to a module that can be named from the outside. As a consequence, all its parents are modules. This is relied upon by update_macro_reachable. All modules are HIR owners, so walking parents by def_key or through HIR is equivalent.
Do you agree with the explanation? Should there be a comment?
Can the loop be simplified using tcx.hir().parent_owner_iter()?
There was a problem hiding this comment.
Is this used somewhere with another Id?
There was a problem hiding this comment.
Yes, rustdoc uses AccessLevels<DefId> and actually adds foreign ids to the table as public or exported, I didn't investigate why exactly.
There was a problem hiding this comment.
IIRC it's because rustdoc needs to do its own privacy pass because rustc's is incorrect (#64762). It may be possible to remove when that's fixed, but don't quote me on that.
and passes using them - primarily privacy checking, stability checking and dead code checking. WIP
|
Updated. |
|
@bors r+ |
|
📌 Commit f921410 has been approved by |
|
⌛ Testing commit f921410 with merge 8f0efc93fd987665366d79b755a92641832ed0d1... |
|
💔 Test failed - checks-actions |
@bors retry |
|
☀️ Test successful - checks-actions |
rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables and passes using those tables - primarily privacy checking, stability checking and dead code checking. All these passes work with definitions rather than with arbitrary HIR nodes. r? `@cjgillot` cc `@lambinoo` (rust-lang#87487)
rustc_privacy: Replace `HirId`s and `DefId`s with `LocalDefId`s where possible Follow up to rust-lang#87568
and passes using those tables - primarily privacy checking, stability checking and dead code checking.
All these passes work with definitions rather than with arbitrary HIR nodes.
r? @cjgillot
cc @lambinoo (#87487)