-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc_metadata: Privatize more things and a couple of other refactorings #66697
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
d2af54a
to
f93c1e6
Compare
@bors r+ |
📌 Commit f93c1e6bb5074a95eefb12440ba88285e6ec7118 has been approved by |
☔ The latest upstream changes (presumably #66824) made this pull request unmergeable. Please resolve the merge conflicts. |
All of them are read-only
After it's moved to `creader.rs`
…lution Namely, `update_extern_crate`. Also, stop tracking visited crates in `update_extern_crate`, the rank check does the same thing (prevents visiting dependencies if the rank didn't change), but more precisely.
f93c1e6
to
e84c926
Compare
@bors r=eddyb |
📌 Commit e84c926 has been approved by |
rustc_metadata: Privatize more things and a couple of other refactorings This PR continues #66496 and hits the point of diminishing returns. All fields of `CrateRoot` and `CrateMetadata` are privatized. For read-only fields this certainly makes sense, but for a few fields updateable from outside of `rmeta.rs` (mostly `creader.rs`) it was done mostly for consistency, I can make them `pub(crate)` again if requested. `cstore.rs` (which became small after #66496) was merged into `creader.rs`. A few things noticed while making the privacy changes were addressed in the remaining refactoring commits. Fixes #66550 r? @eddyb @Mark-Simulacrum
☀️ Test successful - checks-azure |
Tested on commit rust-lang/rust@d99e0c6. Direct link to PR: <rust-lang/rust#66697> 💔 miri on windows: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung, @rust-lang/infra). 💔 miri on linux: test-fail → build-fail (cc @oli-obk @eddyb @RalfJung, @rust-lang/infra).
@@ -1307,10 +1307,6 @@ impl<'tcx> TyCtxt<'tcx> { | |||
self.all_crate_nums(LOCAL_CRATE) | |||
} | |||
|
|||
pub fn injected_panic_runtime(self) -> Option<CrateNum> { | |||
self.cstore.injected_panic_runtime() | |||
} |
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.
Miri was relying on injected_panic_runtime
... is there a replacement?
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.
Hmm, something like
tcx.crates().iter().find(|cnum| tcx.is_panic_runtime(cnum))
should work without re-exposing things privatized in this PR.
(If that's not ok, I can send a PR re-adding tcx.injected_panic_runtime()
.)
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.
That seems to work, thanks! (modulo some extra *
)
This PR continues #66496 and hits the point of diminishing returns.
All fields of
CrateRoot
andCrateMetadata
are privatized.For read-only fields this certainly makes sense, but for a few fields updateable from outside of
rmeta.rs
(mostlycreader.rs
) it was done mostly for consistency, I can make thempub(crate)
again if requested.cstore.rs
(which became small after #66496) was merged intocreader.rs
.A few things noticed while making the privacy changes were addressed in the remaining refactoring commits.
Fixes #66550
r? @eddyb @Mark-Simulacrum