-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Remove visibility information from HIR #93970
Conversation
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Apparently some imports still miss their visibility entries in the table. |
This comment has been minimized.
This comment has been minimized.
@@ -595,30 +591,16 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc { | |||
|
|||
fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) { | |||
match it.kind { | |||
hir::ItemKind::Trait(.., trait_item_refs) => { | |||
hir::ItemKind::Trait(..) => { | |||
// Issue #11592: traits are always considered exported, even when private. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this whole arm can be removed now (including this comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't removing this arm will change behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but it still looks like a reasonable change.
It can be done in a separate PR.
r=me after addressing the remaining comments and squashing commits. |
This PR introduces untracked information in metadata. As visibility is not in the HIR any more, it's not in the crate_hash, and will create incr comp ICEs in downstream crates. I'll add an extra commit to adress this. |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 1d2707f49db710409cb70bf7cedda3bfc7e28fa7 with merge 5a9e9f6c9170cf730f258de9ecbaac918bf4a913... |
☀️ Try build successful - checks-actions |
This version hashes visibility information into the crate hash, so should be sound in terms of metadata, unblocking. |
@@ -131,6 +131,8 @@ pub struct ResolverOutputs { | |||
pub definitions: rustc_hir::definitions::Definitions, | |||
pub cstore: Box<CrateStoreDyn>, | |||
pub visibilities: FxHashMap<LocalDefId, Visibility>, | |||
/// This field is used to decide whether we should make `PRIVATE_IN_PUBLIC` a hard error. | |||
pub has_pub_restricted: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be included into the crate hash too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only used to emit a diagnostic, which won't appear in metadata. Therefore, it does not need to appear in crate_hash
. I can include it as a safety precaution.
r=me after addressing #93970 (comment) and squashing commits. |
@bors r=petrochenkov |
📌 Commit 0a6e135 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (143eaa8): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
This PR removes redundant information from the HIR to directly use the resolver outputs. The regression only appears on |
The resolver exports all the necessary visibility information through the
tcx.visibility
query.This PR stops having a dedicated visibility field in HIR, in order to use this query.
We keep a
vis_span
field for diagnostic purposes.