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

rustc_metadata: Privatize more things #66496

Merged
merged 10 commits into from
Nov 20, 2019
Merged

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Nov 17, 2019

Continuation of #66056.

The most notable change here is that CrateMetadata is moved from cstore.rs to decoder.rs.
Most of uses of CrateMetadata fields are in the decoder and uses of root: CrateRoot and other fields are so intertwined with each other that it would be hard to move a part of them into cstore.rs to privatize CrateMetadata fields, so we are going the other way round.

cstore.rs can probably be dismantled now, but I'll leave this to some other day.
Similarly, remaining CrateMetadata fields can be privatized by introducing some getter/setter methods, but not today.

r? @eddyb

This allows to privatize their fields.
@eddyb
Copy link
Member

eddyb commented Nov 17, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Nov 17, 2019

📌 Commit febde53 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 17, 2019
Centril added a commit to Centril/rust that referenced this pull request Nov 20, 2019
rustc_metadata: Privatize more things

Continuation of rust-lang#66056.

The most notable change here is that `CrateMetadata` is moved from `cstore.rs` to `decoder.rs`.
Most of uses of `CrateMetadata` fields are in the decoder and uses of `root: CrateRoot` and other fields are so intertwined with each other that it would be hard to move a part of them into `cstore.rs` to privatize `CrateMetadata` fields, so we are going the other way round.

`cstore.rs` can probably be dismantled now, but I'll leave this to some other day.
Similarly, remaining `CrateMetadata` fields can be privatized by introducing some getter/setter methods, but not today.

r? @eddyb
bors added a commit that referenced this pull request Nov 20, 2019
Rollup of 7 pull requests

Successful merges:

 - #66060 (Making ICEs and test them in incremental)
 - #66298 (rustdoc: fixes #64305: disable search field instead of hidding it)
 - #66457 (Just derive Hashstable in librustc)
 - #66496 (rustc_metadata: Privatize more things)
 - #66514 (Fix selected crate search filter)
 - #66535 (Avoid ICE when `break`ing to an unreachable label)
 - #66573 (Ignore run-make reproducible-build-2 on Mac)

Failed merges:

r? @ghost
@bors bors merged commit febde53 into rust-lang:master Nov 20, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants