Skip to content

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

Merged
merged 13 commits into from
Nov 29, 2019

Conversation

petrochenkov
Copy link
Contributor

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

@petrochenkov petrochenkov force-pushed the nocstore branch 2 times, most recently from d2af54a to f93c1e6 Compare November 24, 2019 15:57
@JohnTitor JohnTitor added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 24, 2019
@eddyb
Copy link
Member

eddyb commented Nov 27, 2019

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 27, 2019

📌 Commit f93c1e6bb5074a95eefb12440ba88285e6ec7118 has been approved by eddyb

@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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 27, 2019
@bors
Copy link
Collaborator

bors commented Nov 28, 2019

☔ The latest upstream changes (presumably #66824) made this pull request unmergeable. Please resolve the merge conflicts.

@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 Nov 28, 2019
@petrochenkov
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Collaborator

bors commented Nov 28, 2019

📌 Commit e84c926 has been approved by eddyb

@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 Nov 28, 2019
@bors
Copy link
Collaborator

bors commented Nov 29, 2019

⌛ Testing commit e84c926 with merge d99e0c6...

bors added a commit that referenced this pull request Nov 29, 2019
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
@bors
Copy link
Collaborator

bors commented Nov 29, 2019

☀️ Test successful - checks-azure
Approved by: eddyb
Pushing d99e0c6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 29, 2019
@bors bors merged commit e84c926 into rust-lang:master Nov 29, 2019
@rust-highfive
Copy link
Contributor

📣 Toolstate changed by #66697!

Tested on commit d99e0c6.
Direct link to PR: #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).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Nov 29, 2019
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()
}
Copy link
Member

@RalfJung RalfJung Nov 29, 2019

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?

Copy link
Contributor Author

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().)

Copy link
Member

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 *)

See rust-lang/miri#1085

# for free to join this conversation on GitHub. Already have an account? # 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AllocatorKind::GlobalExe is never constructed
7 participants